Thanks Pierre--added to the list.

If you want to master regular expressions, you may wish to check out
(*ahem*) _Mastering Regular Expressions_, an O'Reilly book by Jeffrey
Friedl.  The first few chapters are really helpful.  The later ones discuss
deterministic finite-state automata and non-deterministic finite-state
automata--one would have to be geekier than I to appreciate them in their
fullness.

Regular expressions vary a good deal from implementation to implementation,
so Pierre's resources may be more immediately useful to Rubyists.

---Michael B.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Pierre Garigue
Sent: January 8, 2006 12:44 AM
To: [email protected]; [email protected]
Subject: Re: [Wtr-general] Newbie - How to get value found
bysearchingforregular expression?

the tutorial 
http://gnosis.cx/publish/programming/regular_expressions.html
had a few other things on regular expressions

but you want the Ruby the pickaxe book 
http://www.pixelmech.com/notebook/2005/12/programming-ruby-the-pickaxe-book/
it has a whole chapter on using regular expressions in ruby 

[---Pierre Garigue, too shy to sign]

-----Original Message-----
From:   Michael Bolton [mailto:[EMAIL PROTECTED]
Sent:   Sat 07-Jan-06 3:12 PM
To:     [email protected]
Cc:     
Subject:        Re: [Wtr-general] Newbie - How to get value found by
searchingforregular expression?
If you change the regular expression from 
 
/[0-9]{8}-[0-9]/
 
to
 
/([0-9]{8}-[0-9])/
 
then after the match, the variable $1 will contain the contents of the
matched string.
 
---Michael B.
 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jon Passmore
Sent: January 5, 2006 6:21 PM
To: [email protected]
Subject: [Wtr-general] Newbie - How to get value found by searching
forregular expression?


I can verify that a value exists that matches a regular expression, but how
can I return that value?

example:  I add a record and it returns a page with a dynamically generated
ID.  The value does not have any tags that will help me locate it so I have
to search using a regular expression. pageContainsText(/[0-9]{8}-[0-9]/)

This works great, but what do I do if I want to return that value and assign
it to a variable?






_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to