[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

usage of Regexp::EXTENDED

Melanie Fielder

10/8/2003 11:35:00 AM

How does it work ?


I tried
assert_match(/bc/x, "ab cd")
But it fails...


ProgrammingRuby says:
EXTENDED Ignore spaces and newlines in regexp.

--
Simon Strandgaard

BTW: I am exercising Rubys regex engine, here:
http://rubyforge.org/cgi-bin/cvsweb.cgi/projects/experimental/nfa_...
t_ruby_regex.rb?rev=1.7&content-type=text/x-cvsweb-markup&cvsroot=aeditor


3 Answers

nobu.nokada

10/8/2003 11:54:00 AM

0

Hi,

At Wed, 8 Oct 2003 20:48:17 +0900,
Simon Strandgaard wrote:
> I tried
> assert_match(/bc/x, "ab cd")
> But it fails...

/bc/x has no spaces.

> ProgrammingRuby says:
> EXTENDED Ignore spaces and newlines in regexp.

But not ignore spaces and newlines in the target string.

--
Nobu Nakada

Jim Weirich

10/8/2003 11:59:00 AM

0

On Wed, 2003-10-08 at 07:48, Simon Strandgaard wrote:
> How does it work ?
>
>
> I tried
> assert_match(/bc/x, "ab cd")
> But it fails...

Try: assert_match(/b c/x, "abcd")


--
-- Jim Weirich jweirich@one.net http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Simon Strandgaard

10/8/2003 12:51:00 PM

0

On Wed, 08 Oct 2003 21:58:42 +0900, Jim Weirich wrote:

> On Wed, 2003-10-08 at 07:48, Simon Strandgaard wrote:
>> How does it work ?
>>
>>
>> I tried
>> assert_match(/bc/x, "ab cd")
>> But it fails...
>
> Try: assert_match(/b c/x, "abcd")

that works.. but

assert_match(/b \nc/x, "abcd")

fails ?

programming-ruby says that newlines will be ignored?

--
Simon Strandgaard