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
LVL 1
ArrummzenAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
m/(\w+)\b(?!\s*\()/g
0
 
mlmccCommented:
What language?

What is PCRE?

mlmcc
0
 
ArrummzenAuthor Commented:
Python.
PCRE = PERL Compatable Regular Expressions

Thank you for your time,
Arrummzen
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
ArrummzenAuthor Commented:
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
 
ozoCommented:
"(?!pattern)"
                 A zero-width negative look-ahead assertion.  For example
                 "/foo(?!bar)/" matches any occurrence of "foo" that isn't
                 followed by "bar".  
0
 
ArrummzenAuthor Commented:
I am very sorry it has taken me so long to close this question.

Thank you for your time,
Arrummzen
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.