Link to home
Start Free TrialLog in
Avatar of Arrummzen
Arrummzen

asked on

REs. A question (PERL Compatable Regular Expressions)

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
Avatar of Mike McCracken
Mike McCracken

What language?

What is PCRE?

mlmcc
Avatar of Arrummzen

ASKER

Python.
PCRE = PERL Compatable Regular Expressions

Thank you for your time,
Arrummzen
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
"(?!pattern)"
                 A zero-width negative look-ahead assertion.  For example
                 "/foo(?!bar)/" matches any occurrence of "foo" that isn't
                 followed by "bar".  
I am very sorry it has taken me so long to close this question.

Thank you for your time,
Arrummzen