Re: How to find this pattern by regular expression?



Ahmad wrote:
I want to find the pattern: PATTERN that can contain lower case or
upper case characters, digits, and special characters like : _ ; ( )
& .

A sample context is:

PATTERN {
@ a line containing anything(comment line)
@ multiple comment lines can exist
// Another type of comments
/* Third type of comments
and it's a multiline comment
*/
x1=a AND b
y1= x1 OUTSIDE layer100
copy y1

//Comments can exist anywhere in the text (between the braces)

// this is the closing brace }

my ($pattern) = /([\w:;()&.]+)\s+{.+?}/s;

Any guidance about the most efficient RE to perform that?

Efficient? What makes you consider efficiency being an issue?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: How to find this pattern by regular expression?
    ... I want to find the pattern: PATTERN that can contain lower case or ... -- Start here (this line is not in context) ... /* Third type of comments ... // this is the closing brace} ...
    (comp.lang.tcl)
  • Re: How to find this pattern by regular expression?
    ... I want to find the pattern: PATTERN that can contain lower case or ... -- Start here (this line is not in context) ... /* Third type of comments ... // this is the closing brace} ...
    (comp.lang.perl.misc)
  • How to find this pattern by regular expression?
    ... I want to find the pattern: PATTERN that can contain lower case or ... /* Third type of comments ... // this is the closing brace} ... I need when apply regular expression on the above sample context, ...
    (comp.lang.tcl)
  • How to find this pattern by regular expression?
    ... I want to find the pattern: PATTERN that can contain lower case or ... /* Third type of comments ... // this is the closing brace} ... I need when apply regular expression on the above sample context, ...
    (comp.lang.perl.misc)
  • Help on RegExp
    ... I made a pattern to exclude HTML tags and text within the opening ... brace '{' and the closing brace '}' and match all the rest. ...
    (comp.lang.javascript)