I looked through the archives, but couldn’t find a comprehensive
tutorial on regular expressions – could someone please point me to
one?
Specifically, I’m looking to extract all the words from a string that
are capitalized, but can’t find case-based match operators.
Thanks,
Siddarth
This one gives a good overview and
samplehttp://rubylearning.com/satishtalim/ruby_regular_expressions.html
This one provides a list of common
expressionshttp://www.rubyist.net/~slagell/ruby/regexp.html
Here is a tester for your ruby regular expressions.http://rubular.com/
Hope this helps
chris williams
To test regular expressions (and with a handy little regex reference at
the bottom), use rubular: http://rubular.com/
And for your particular issue, try this:
str = “this Is Some test String eh?” cap_words = str.scan(/[A-Z]\w+/)
Got it, thanks!
Siddarth
On Wed, Jun 16, 2010 at 9:34 PM, Siddarth Chandrasekaran
On Thu, Jun 17, 2010 at 12:42 AM, Siddarth Chandrasekaran <
[email protected]> wrote:
one?
Sounds like you are using the proposed regex. Why don’t you go to the
given
site (rubular), put in “javaVariable”, and see if it gives you what you
expect.
If not, here is a decent explanation of the different things you could
do to
match. Ruby | zenspider.com | by ryan davis
Sounds like you are using the proposed regex. Why don’t you go to the given
site (rubular), put in “javaVariable”, and see if it gives you what you
expect.
Nope, I edited the regex to account for spaces.
If not, here is a decent explanation of the different things you could do to
match. Ruby | zenspider.com | by ryan davis
Great, thanks!
Siddarth
On 17.06.2010 06:34, Siddarth Chandrasekaran wrote:
I looked through the archives, but couldn’t find a comprehensive
tutorial on regular expressions – could someone please point me to
one?
Not exactly a tutorial but a very comprehensive book on the matter is
“Mastering regular expressions”.
Kind regards
robert