Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

REs. A question (PERL Compatable Regular Expressions)

Posted on 2004-03-21
6
208 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
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…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

790 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