On May 22, 2014, at 2:04 AM, <[email protected]> <[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?


The Regexp::Common module, available from cpan.org, has several useful 
categories of regular expressions. Among these is Regexp::Common::delimited for 
finding delimited strings, which you may find useful.



--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to