On 22 May 2014, at 10:04, [email protected] wrote:
> I need to extract some information from source code.
>
> How can I write a perl regular expression that will match a literal string in
> languages like C#, javascript, java and lisp?
>
> Here is my naive approach:
>
> /"[^"]*"/
>
> This of course does not accommodate backslashes in the string that perl, C,
> C# javascript use.
>
> "\"sdfds\"\\r\\t\\m".
>
> How can I write a regular expression in perl to look for a double quoted
> literal string in these languages?
>
> Thanks
> Siegfried
> -- To unsubscribe, e-mail: [email protected] For additional
> commands, e-mail: [email protected] http://learn.perl.org/
Maybe something like this? (negative look-behind)
say $1 if /(".*(?<!\\)")/;