Solved

REs. A question (PERL Compatable Regular Expressions)

Posted on 2004-03-21
6
207 Views
Last Modified: 2010-04-17
I need to make a PCRE, that will match any alpha string that is followed is is not followed by a parenthese.
So for
a = b + c * sin ( x )
match
a
b
c
x
but
not

It should also match multi character terms -
answer = variable + function ( Number )
for the above, match-
Answer
variable
Number
but not
function

How would I do this?

Thank you for your time,
Arrummzen
0
Comment
Question by:Arrummzen
  • 3
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 10646473
What language?

What is PCRE?

mlmcc
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10646474
Python.
PCRE = PERL Compatable Regular Expressions

Thank you for your time,
Arrummzen
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 10646494
m/(\w+)\b(?!\s*\()/g
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Author Comment

by:Arrummzen
ID: 10646508
In Python - re.compile ( '(\\w+)\\b(?!\s*\\()' )

What is this ?! all about? Im not sure what you are doing there. It works though.

Thank you for your time,
Arrummzen
0
 
LVL 84

Expert Comment

by:ozo
ID: 10646652
"(?!pattern)"
                 A zero-width negative look-ahead assertion.  For example
                 "/foo(?!bar)/" matches any occurrence of "foo" that isn't
                 followed by "bar".  
0
 
LVL 1

Author Comment

by:Arrummzen
ID: 10729738
I am very sorry it has taken me so long to close this question.

Thank you for your time,
Arrummzen
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS - Suppress row when blank from 2nd dataset 2 55
Base1 Encode/Decode 3 77
Bulk Reorder File Names 4 67
how to use laptop or pad camera in vb.net windows application 2 71
A short article about a problem I had getting the GPS LocationListener working.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question