Re: How to find this pattern by regular expression?



Ahmad <ahmad.abdulghany@xxxxxxxxx> wrote:
Hi,

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


/[\w:;()&.]+/


A sample context is:

-- Start here (this line is not in context)

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 }

-- End here (this line is not in context)

I need when apply regular expression on the above sample context, it
return the word PATTERN.


my($match) = $context =~ /(PATTERN)/;


Any guidance about the most efficient RE to perform that?


You should first try to find ANY regex that does what you want.

Only if it proves to be too slow should you concern yourself with
making it faster.


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
.



Relevant Pages

  • Re: Abstract public member variales?
    ... specific context of processing streams of arbitrary objects. ... However, polymorphic dispatch is ... for the client depending on context. ... the Serializer pattern. ...
    (comp.object)
  • Re: Shooter at Ft Hood survived
    ... I've had personal experience with a similar incident. ... wondering what you missed that, had you been able to know the context, ... this guy start comparing notes that the pattern becomes apparnt. ...
    (sci.military.naval)
  • Re: Shooter at Ft Hood survived
    ... I've had personal experience with a similar incident. ... wondering what you missed that, had you been able to know the context, ... this guy start comparing notes that the pattern becomes apparnt. ...
    (sci.military.naval)
  • Re: Shooter at Ft Hood survived
    ... I've had personal experience with a similar incident. ... wondering what you missed that, had you been able to know the context, ... this guy start comparing notes that the pattern becomes apparnt. ...
    (sci.military.naval)
  • Re: Why encapsulate state pattern......
    ... >i) the programmer knows explicitly what stimili are valid in a specific ... >context (I put a dot after the object and it tells me in my ide what is ... >pattern, i.e. state changes render a state invalid, all stimili require ... "The aim of science is not to open the door to infinite wisdom, ...
    (comp.object)