Why? I don't know, but I've never been able to wrap my head around regular expressions. Now I'm stuck, not even sure it's possible, but it probably is
I need to test a string for 'test'. Simple enough. This 'test' must also be at the start of the string. Still simple enough. 'test' at the start of the string must NOT be followed by ' -' (space hyphen), this is where I'm stuck.
eg...
test blahblahblah - pass
test - blahblahblah - fail, followed by ' -'
a test blahblahblah - fail, not start of string.
a test - blahblahblah - fail, not start of string and followed by ' -'
Note: blahblahblah will be a random number and selection of characters but 'test' will always be 'test'.
Ultimately, I need to rename millions of files of the format 'test blahblahblah' to 'test - blahblahblah' without renaming them 'test - - blahblahblah'. Hope that make sense??
Anyone good with regex help me out?
Cheers !
I need to test a string for 'test'. Simple enough. This 'test' must also be at the start of the string. Still simple enough. 'test' at the start of the string must NOT be followed by ' -' (space hyphen), this is where I'm stuck.
eg...
test blahblahblah - pass
test - blahblahblah - fail, followed by ' -'
a test blahblahblah - fail, not start of string.
a test - blahblahblah - fail, not start of string and followed by ' -'
Note: blahblahblah will be a random number and selection of characters but 'test' will always be 'test'.
Ultimately, I need to rename millions of files of the format 'test blahblahblah' to 'test - blahblahblah' without renaming them 'test - - blahblahblah'. Hope that make sense??
Anyone good with regex help me out?
Cheers !