Regular Expression help

A

asadikhan

Hi,

I want to create a regular expression. I have come up with something
like this:

Scan*ValRel(QualValRel)*

which basically means that I should see:

zero or more of "Scan"
exactly one of "Val"
exactly one of "Rel"
zero or more of "ScanValRel"

however I can't seem to get this right. I used Expresso as well to try
to come up with the right expression. The closest I got was:

(Scan)*(Val)(Rel)(QualValRel)*

but this allows

ScanValValRel (as it finds ValRel as part of this string). I don't want
it to do that.

As specified above, I want to find exactly one of Val (no more) etc.

How do I do this?
 
J

jburgy

Hi,

I want to create a regular expression. I have come up with something
like this:
snip

(Scan)*(Val)(Rel)(QualValRel)*

you probably want to learn more about ^ and $ or other anchors
(beginning of word for example)

Jan
 
B

Big and Blue

I want to create a regular expression. I have come up with something
like this:

Scan*ValRel(QualValRel)*

which basically means that I should see:

zero or more of "Scan"

No. Sca followed by any number of n.
exactly one of "Val"
exactly one of "Rel"
zero or more of "ScanValRel"

....of QualValRel.
....
(Scan)*(Val)(Rel)(QualValRel)*

but this allows

ScanValValRel (as it finds ValRel as part of this string). I don't want
it to do that.

And it won't do that (since that re will only match ValRel or
ValRelQualValRel, etc., preceded by any number of Scan), so if it does
you've mistyped the re.

It might help if you actually said what you wanted to match, rather
than just giving things which you say have failed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top