# Regular expression

**URL:** <https://www.ruby-forum.com/t/regular-expression/189654>\
**Category:** Rails\
**Created:** [June 4, 2010, 3:30pm UTC](https://www.ruby-forum.com/t/regular-expression/189654 "2010-06-04T15:30:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 4, 2010, 3:30pm UTC](https://www.ruby-forum.com/t/regular-expression/189654/1 "2010-06-04T15:30:23Z")

</div>

Can u help me in simple regular expression that will match the string  
‘123\_456\_7890’ but not ‘123\_456\_789’.

---

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 4, 2010, 3:33pm UTC](https://www.ruby-forum.com/t/regular-expression/189654/2 "2010-06-04T15:33:19Z")

</div>

On Jun 4, 1:28 pm, Srinivas G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can u help me in simple regular expression that will match the string  
> ‘123\_456\_7890’ but not ‘123\_456\_789’.

You’re going to have to be a little more specific - the regular  
expression /0/ matches the first string and not the second but that’s  
probably not what you wanted.

Fred

---

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 4, 2010, 3:39pm UTC](https://www.ruby-forum.com/t/regular-expression/189654/3 "2010-06-04T15:39:45Z")

</div>

On 04 Jun 2010, at 14:28, Srinivas G. wrote:

> Can u help me in simple regular expression that will match the string  
> â€˜123\_456\_7890â€™ but not â€˜123\_456\_789â€™.

The thing you’re asking is not very specific, there’s a lot to be  
interpreted, but this might be what you are looking for: \d{3}_\d{3}_  
\d{4}

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 4, 2010, 10:41pm UTC](https://www.ruby-forum.com/t/regular-expression/189654/4 "2010-06-04T22:41:51Z")

</div>

Do you know a site of that quality ([rubular.com](http://rubular.com)) for XPath??? That  
site rocks!!!

---

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 4, 2010, 10:50pm UTC](https://www.ruby-forum.com/t/regular-expression/189654/5 "2010-06-04T22:50:38Z")

</div>

Well, Google found this one pretty quick:  
[http://www.mizar.dk/XPath/Default.aspx](http://www.mizar.dk/XPath/Default.aspx)

Maybe it can find others, too, if that one doesn’t work for you.  
-Rob

On Jun 4, 2010, at 4:40 PM, chewmanfoo wrote:

> > > \d{3}\_  
> > > removed\_email\_address@domain.invalid.  
> > > To unsubscribe from this group, send email to removed\_email\_address@domain.invalid  
> > > .  
> > > For more options, visit this group at [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en)  
> > > .

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 5, 2010, 10:24am UTC](https://www.ruby-forum.com/t/regular-expression/189654/6 "2010-06-05T10:24:20Z")

</div>

\d{3}_\d{3}_\d{4}., thats the answer.,

i really appreciate., thanks a lot.

Can you guide me for this please.,  
2. In Ruby there is a command called ‘require’. Explain what this  
command means and write an example of how it is used to include a Ruby  
Gem in a file.

---

<div class="post-metadata">

**Author:** ![Srinivas\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/48db29/32.png) [@Srinivas\_G](https://www.ruby-forum.com/u/Srinivas_G)\
**Post date:** [June 4, 2010, 8:17pm UTC](https://www.ruby-forum.com/t/regular-expression/189654/7 "2010-06-04T20:17:50Z")

</div>

ENTER [http://rubular.com/](http://rubular.com/)

I Need regular expression that will match the string ‘123\_456\_7890’  
not ‘123\_456\_789’
