Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #7275

Re: Regular Expression Help

From BootNic <bootnic.bounce@gmail.com>
Newsgroups comp.lang.php
Subject Re: Regular Expression Help
Date 2012-10-08 13:39 -0400
Organization BootNic Party Make your vote count!
Message-ID <20121008133958.3af22958@bootnic.server> (permalink)
References <k4tkan$ea$1@dont-email.me>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

In article <k4tkan$ea$1@dont-email.me>, Scott Johnson
<noonehome@chalupasworld.com> wrote:

> I have two possible values I need to match as the same.

> Name/11 (This one is pulled from the source DB) Name/11* (This is what
> I need to match to with or without the (*))

> The pattern base name is pulled from a DB so I need to find a way to
> do this pragmatically.

> Now some of the names have a forward slash / so I am using hash mark #
> as a delimiter.

> I was able to find the "Name/11" using

> #^Name/11#

> or more specifically;

> $value = "Name/11"; $pattern = "#^" . $value . "#";

> But as for the (*), no glory. I originally tried

> #^Name/11?*# #^Name/11\*# #^Name/11.*#

> It must be obvious I am having issues finding a way to escape the (*)
> and am not very versed with regex.

[url] http://www.regular-expressions.info/characters.html [/url]

 \* 

[url] http://www.regular-expressions.info/charclass.html [/url]

[*]

> Can someone please explain the best way to escape an optional (*) from
> a string. Or even point me to a good source.

#Name/11(?:[*])?#

[url] http://www.regular-expressions.info/brackets.html [/url]

[snip]



-- 
BootNic                                                Mon Oct 8, 2012 01:39 pm
  Genius is eternal patience.
  *Michelangelo*

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Regular Expression Help Scott Johnson <noonehome@chalupasworld.com> - 2012-10-07 21:20 -0700
  Re: Regular Expression Help Captain Paralytic <paul_lautman@yahoo.com> - 2012-10-08 03:03 -0700
  Re: Regular Expression Help Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-08 12:49 +0000
  Re: Regular Expression Help Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-08 12:59 +0000
  Re: Regular Expression Help BootNic <bootnic.bounce@gmail.com> - 2012-10-08 13:39 -0400
  Re: Regular Expression Help "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-10-09 12:29 +0200
  Re: Regular Expression Help Scott Johnson <noonehome@chalupasworld.com> - 2012-10-10 03:38 -0700

csiph-web