Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > pattern mattching

Reply
Thread Tools

pattern mattching

 
 
Pascal
Guest
Posts: n/a
 
      02-13-2004
I'm try to match a pattern which doesn't really work for me kuz I just
want the pattern to appear once for example I have this line:

int x=0;x<=100;x++

I only what this: =, <=, ++
but I get all of these: =,<,=,<=,+,+,++
because In an other line I could have this: y=x+y then I would like to
have:=,+
but I can't seem to figure out what pattern to use That would work for
all situation.
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      02-13-2004
Pascal <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> I'm try to match a pattern which doesn't really work for me kuz I just
> want the pattern to appear once for example I have this line:
>
> int x=0;x<=100;x++
>
> I only what this: =, <=, ++
> but I get all of these: =,<,=,<=,+,+,++


So what pattern are you using?

> because In an other line I could have this: y=x+y then I would like to
> have:=,+


Looks like you're after the operators in C code. If so, why don't
you say so?

> but I can't seem to figure out what pattern to use That would work for
> all situation.


What are "all" situations?

If my assumption is right that you want to parse C code for operators,
pattern matching won't do. You'll need a parser. Your best best is
probably Parse::RecDescent. There may even be (partial) C parsers
on CPAN.

Anno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ and design Pattern (Composite design Pattern ) Pallav singh C++ 0 01-22-2012 10:26 PM
C++ and design Pattern (Composite design Pattern ) Pallav singh C++ 0 01-22-2012 10:25 PM
May I have a example of design pattern of "composite", I still feel fuzzy after reading book of Addison-Wesley's"design pattern " jones9413@yahoo.com C++ 1 08-31-2007 04:09 AM
documents related to factory design pattern and Abstract foctory pattern. sunny C++ 1 12-07-2006 04:26 AM
boolean endsWith(String s, Pattern pattern) lepikhin@gmail.com Java 17 11-16-2005 10:31 AM



Advertisments