Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Regular Expression help

Reply
Thread Tools

Regular Expression help

 
 
asadikhan@gmail.com
Guest
Posts: n/a
 
      07-18-2005
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?

 
Reply With Quote
 
 
 
 
jburgy@gmail.com
Guest
Posts: n/a
 
      07-18-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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

 
Reply With Quote
 
 
 
 
Big and Blue
Guest
Posts: n/a
 
      07-18-2005
(E-Mail Removed) wrote:
>
> 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.




--
Just because I've written it doesn't mean that
either you or I have to believe it.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seek xpath expression where an attribute name is a regular expression GIMME XML 3 12-29-2008 03:11 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C++ 42 11-04-2008 12:39 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C Programming 45 11-04-2008 12:39 PM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments