[ragel-users] Re: Newbie question - regarding anchoring
gautham a n
angaut... at yahoo.com
Mon Jul 2 04:15:44 UTC 2007
Hi,
Thanks a lot for the clarification. I understand now.
-gautham
----- Original Message ----
From: Adrian Thurston <thurs... at cs.queensu.ca>
To: ragel-users at googlegroups.com
Sent: Friday, June 29, 2007 7:35:04 PM
Subject: [ragel-users] Re: Newbie question - regarding anchoring
Hello,
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.
Cheers,
Adrian
>
> 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.
>
> -gautham
>
> ----- 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
>
> Hi,
>
> 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.
>
> Cheers,
> Adrian
>
> gautham wrote:
>> Hi,
>>
>> 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.
>>
>> -gautham
>>
>>
>>
>
>
>
>
>
>
> ____________________________________________________________________________________
> Sick sense of humor? Visit Yahoo! TV's
> Comedy with an Edge to see what's on, when.
> http://tv.yahoo.com/collections/222
>
>
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC
More information about the ragel-users
mailing list