[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Joining two regexps

Edgardo Hames

1/14/2005 12:45:00 PM

Hi, everybody.

I would like to join two regular expression, actually place a regexp
_inside_ another one, like:

IP_ADDRESS = %r{(?:\d{1,3}\.){3}\d{1,3}}
RESPONSE = %r{SERVER IP_ADDRESS}

In RESPONSE, IP_ADDRESS should be the pattern that matches an IP
address, but I don't figure out how to do that. Could you please help
me?

Thaks a lot,
Ed
--
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw


1 Answer

Ilmari Heikkinen

1/14/2005 12:52:00 PM

0

Hi,

On 14.1.2005, at 14:44, Edgardo Hames wrote:

> Hi, everybody.
>
> I would like to join two regular expression, actually place a regexp
> _inside_ another one, like:
>
> IP_ADDRESS = %r{(?:\d{1,3}\.){3}\d{1,3}}
> RESPONSE = %r{SERVER IP_ADDRESS}
>
> In RESPONSE, IP_ADDRESS should be the pattern that matches an IP
> address, but I don't figure out how to do that. Could you please help
> me?

RESPONSE = %r{SERVER #{IP_ADDRESS}}