Stumped with simple regular expression

  • Thread starter Thread starter Bryan Ax
  • Start date Start date
B

Bryan Ax

My regular expression inadequacies are surfacing again...

I'm trying to write a simple regex to match either the character S, or
the character O, or the phrase SP (but not the phrase SO, or SP, or any
other phrase).

I've tried simply:

[SO]|SP

but that still seems to match the phrase 'SO'

What I really need is something that says, the above, but don't allow
'SO'.

I feel so silly - I thought I was going to get this one done very
quickly...

Any help appreciated,

Bryan
 
Oops - error in above. It should read but not the phrase SO, or OP, or
any
other phrase). SP is OK.
 
Bryan said:
My regular expression inadequacies are surfacing again...

I'm trying to write a simple regex to match either the character S, or
the character O, or the phrase SP (but not the phrase SO, or SP, or any
other phrase).

sp|s|o
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top