in reply to Re: Regex with Backslashes (updated)
in thread Regex with Backslashes
Thanks for taking the time to point out the issues with my presentation of strings, which has caused confusion.
If I post again I will take your advice on the presentation and the use of quoting.
Having considered the problem I originally posted, I have decided that I should take a slightly different approach which I touched on in a response to another monk, and my data will use two commas where a non-splitting comma is required and two backslashes where a backslash is required. This changes the regex requirements substantially.
My data would look like this: 1,Text,,with,,commas,X,99 and my regex is: my $regex = qr /(?<!,),(?!,)|(?<=,,),/;
This is working in my script with this output:
1 Text,,with,,commas X 99
Thank you to all who responded.
Maybe I will take the plunge and post my 'lcd daemon with battery meter script' once it is completed. Not exactly an Earth-shattering piece of work, but quite fun.