Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: General Regular Expression Question


Message #1 by "Mark Carruth" <mcarruth@t...> on Fri, 29 Nov 2002 17:41:50 -0000
I know that you can do something like

(\'|)

Which essentially means ' or nothing

so this might work..

([[:alpha:]]*)(=)(\'|)([[:alnum:]]+)(\'|)


Cheers,
Justin :)

> -----Original Message-----
> From: Mark Carruth [mailto:mcarruth@t...]
> Sent: 29 November 2002 17:42
> To: professional php
> Subject: [pro_php] General Regular Expression Question
> 
> 
> This is merely a hypothetical question, but useful to know none the
> less.
> 
> Say I had the string
> 
> "something=value" OR
> "something='value'"
> 
> When I write might regular expression to match the string as a whole,
> something like:
> 
> eregi("([[:alpha:]]*)(=)([[:alnum:]]+)", $string, $regs);
> 
> Is there a way of specifying that around '([[:alnum:]]+)' that there
> *might* be a specific character, but not to refuse the match if there
> isn't?
> 
> P.S: I'm not really concerned about the correct/incorrectness of the
> expression I have written, so don't bother correcting it :P
> 
> Regards,
> --------------------
> Mark Carruth 
> 
> 
> 

  Return to Index