[ragel-users] Re: Newbie question - regarding anchoring
thurs... at cs.queensu.ca
Fri Jun 29 14:05:04 UTC 2007
gautham a n wrote:
> would print "you said hello.\n" for both input strings - "Hello world"
> and "world Hello abcdef".
That is true of regular expressions as they are commonly known, but it
is not the case with Ragel. Ragel is more like a parser generator that
works with regular languages than a regular expression engine. If you
wanted to match the second string you would either have to put an "any*"
at the front or manually re-call the machine at every input location.
> But, what would I need to do if I wanted the above printf() to be called only in the case when "Hello" is found at the beginning of the input string and, don't want the printf() to be called if some other substring is present at the beginning of the input string ?
> Thanks in advance.
> ----- Original Message ----
> From: Adrian Thurston <thurs... at cs.queensu.ca>
> To: ragel-users at googlegroups.com
> Sent: Thursday, June 28, 2007 8:55:43 PM
> Subject: [ragel-users] Re: Newbie question - regarding anchoring
> Ragel does not employ a regular expression matching engine, just a
> simple state machine which begins operation at the start of the input
> string. Since it does not attempt to match a pattern at every input
> position you don't need ^ to restrict the pattern to the beginning of an
> input string.
> gautham wrote:
>> I am new to Ragel. I am trying out different regular expressions to
>> gain more familiariaty.
>> I am unable to write a regex which is matched only when it is found at
>> the beginning of the input string. For example, the regex should match
>> "hello world start" and not match "world hello start".
>> I tried using "^hello" - similar to lex/awk, but the "^" seems to be
>> interpreted literally.
>> Thanks in advance.
> Sick sense of humor? Visit Yahoo! TV's
> Comedy with an Edge to see what's on, when.
> You received this message because you are subscribed to the Google Groups "ragel-users" group.
> To post to this group, send email to ragel-users at googlegroups.com
> To unsubscribe from this group, send email to ragel-users-unsubscribe at googlegroups.com
> For more options, visit this group at http://groups.google.com/group/ragel-users?hl=en
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 252 bytes
Desc: OpenPGP digital signature
More information about the ragel-users