Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.albasani.net!.POSTED!not-for-mail From: BootNic Newsgroups: comp.lang.php Subject: Re: Regular Expression Help Date: Mon, 8 Oct 2012 13:39:58 -0400 Organization: BootNic Party Make your vote count! Lines: 72 Message-ID: <20121008133958.3af22958@bootnic.server> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/YfvfcSx+8pM8h6NdUu5i8v/"; protocol="application/pgp-signature" X-Trace: news.albasani.net FB5RS41Zd/pYlRro0HYssBLfdSU7SxvJNscIhzLRC8Aq8BdJuRvbtF0e17fgKW5epfqrmw5Aqv8np0Cf1IVSpA== NNTP-Posting-Date: Mon, 8 Oct 2012 17:40:04 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="rKacg1j0/FTibeZ9wXIpzvCOOm62CkUgvkg0kezF/ui+dG5zs+v9JxWWSK1b4eqvGGO7rbm5QDyyKJsk/l679TLphx7ZAUeOfDA8FePjnoVUgsRuciqZxCCefx0BcVDj"; mail-complaints-to="abuse@albasani.net" User-Agent: Claws Mail X-Mailer: Claws Mail X-Newsreader: Claws-Mail face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAABhQTFRFAAAAACE A/97e562cvVpK5wAAznNS1r1CTn3nxwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAA AHdElNRQfbAwEEGy452DVwAAAB1ElEQVQ4y1WUTZLjMAiFfRbjzAGErN5HUc3eEn2Adld6P0m1rj8P/ dlmE4evgIcEmuZiqyn2kTPH6pnqT/1HOed/6xmQWQX2F+BF5gDki1+ymrdmgMVIBa9nzm+6D8DUwC// 5Gy4A8vVLz8vhi5h34C/SU/FDmCzFTRJCt4Ab4kqbBqSagRqZIkQNg1JIin/7qjxFoGwaUgS8c+dnf8 IIhA2rV2SfHI1/eY0xS5J4gls67QdwB0gLhoROYjnkwUFiEArAuXU3OiuRiT96mAvYC0RkZJZkyd2xc /0bZYKFsGhRPIAjv+gr7iUVAA+KNBUjhRQjZgJzUYqeZiOiKSqFKghjB6thqgqTYUIF0+qcHrz2mrgF NPoAydgbk0VSJr5UTvHRW0KNBOzTdTPykOuAnbwf906ULmhNFgCzAXMpbhjtzMOZ6TCAVK9Jq0uR4Qk XABuk/d9ZysSRkQdEeYnUrVROoEIUTv3ycCdr22s0LfKbQBTQttSP4uNTHedxHCAUEGZRPK21HZ9dBB gFcxW7ymdMxnf9mO5gr4f2KjQQJPUN4rutg6ubZLMaWvjEXDaWixVGkAljZfBzgq+q6RwfUtcm+f58p bM61gDmy6AwqP3ca+e/27CGQClLJe3AAAAAElFTkSuQmCC Content-Language: en X-Operating-System: Linux wetBox 3.1.4.7.22 X-Face: "b}DIfR1vz!3oiDs)txy9^EYii7~LSERS*Z,K;N1m!_5v~hPEqLdfbyrq- Cancel-Lock: sha1:T0R9GwKMzOzYoHF2XiuR/ptVF8s= Accept-Language: en Xref: csiph.com comp.lang.php:7275 --Sig_/YfvfcSx+8pM8h6NdUu5i8v/ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable In article , Scott Johnson 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 =3D "Name/11"; $pattern =3D "#^" . $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] \*=20 [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] --=20 BootNic Mon Oct 8, 2012 01:3= 9 pm Genius is eternal patience. *Michelangelo* --Sig_/YfvfcSx+8pM8h6NdUu5i8v/ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAlBzD+4ACgkQOcdbyBqMFBHNTwCgsew7MQC8mkdLlYYpIls9q/qt AqcAoKl9A+WJGq4zkXRBuVQ4eG2xbPjx =GyJG -----END PGP SIGNATURE----- --Sig_/YfvfcSx+8pM8h6NdUu5i8v/--