# RegEx Tutorial?

**URL:** <https://www.ruby-forum.com/t/regex-tutorial/190257>\
**Category:** Ruby\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257 "2010-06-17T16:22:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/1 "2010-06-17T16:22:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/2 "2010-06-17T16:26:21Z")

</div>

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/](http://rubular.com/)  
Hope this helps  
chris williams

---

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/3 "2010-06-17T16:26:21Z")

</div>

To test regular expressions (and with a handy little regex reference at  
the bottom), use rubular: [http://rubular.com/](http://rubular.com/)  
And for your particular issue, try this:  
str = “this Is Some test String eh?” cap\_words = str.scan(/[A-Z]\w+/)

- Ehsan

---

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/4 "2010-06-17T16:26:22Z")

</div>

Got it, thanks!

Siddarth

On Wed, Jun 16, 2010 at 9:34 PM, Siddarth Chandrasekaran

---

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/5 "2010-06-17T16:27:01Z")

</div>

On Thu, Jun 17, 2010 at 12:42 AM, Siddarth Chandrasekaran \<  
removed\_email\_address@domain.invalid\> 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](http://www.zenspider.com/Languages/Ruby/QuickRef.html#11)

---

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:27pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/6 "2010-06-17T16:27:03Z")

</div>

> 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](http://www.zenspider.com/Languages/Ruby/QuickRef.html#11)

Great, thanks!

Siddarth

---

<div class="post-metadata">

**Author:** ![Siddarth\_Chandrasek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c4cdca/32.png) [@Siddarth\_Chandrasek](https://www.ruby-forum.com/u/Siddarth_Chandrasek)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/regex-tutorial/190257/7 "2010-06-17T16:26:59Z")

</div>

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
