Regular expressions

I’m writing a script that is looking through a file for the following
lines

something

and replacing it with

something - info about the something

my problem is that I can’t find info about searching for the “*”
character.

I’ve been reviewing the regular expression docs and can only find the
usage for “*” and not how to search for #{stuff}

any help would be great.

Jesús Gabriel y Galán wrote:

On Mon, Apr 26, 2010 at 7:28 PM, Kevin A. [email protected]
wrote:

something - info about the something

my problem is that I can’t find info about searching for the “*”
character.

I’ve been reviewing the regular expression docs and can only find the
usage for “*” and not how to search for #{stuff}

  • is a special character for regular expressions, so you have to escape
    it:

/*something*/

Jesus.

Knew it was something stupid

Thanks

On Mon, Apr 26, 2010 at 7:28 PM, Kevin A. [email protected]
wrote:

something - info about the something

my problem is that I can’t find info about searching for the “*”
character.

I’ve been reviewing the regular expression docs and can only find the
usage for “*” and not how to search for #{stuff}

  • is a special character for regular expressions, so you have to escape
    it:

/*something*/

Jesus.

my problem is that I can’t find info about searching for the “*”
character.

Regexp.escape(“something”) is handy too.

Gavin