Sign in to follow this  
Followers 0
sensalim

Need another regexp help

3 posts in this topic

#1 ·  Posted (edited)

I have this

p[\s*|\.|\,]*o[\s*|\.\,]*b\s*o\s*x[\s*\|\.|\,]*.*

but I want to strip the POBox. Examples:

"POBox111" --> "111"

"222 PO Box 333" --> "333"

"44P OB o x 55" --> "55"

How do I fix my pattern? backreference?

Any help?

Thanks!

Edit:

or I could use (x)(\s*)(.*)

but I still need to ignore the 'x'...

Edit:

of course I could just strip the first letter (x) from the result afterwards, but would like to know how to do this in regex properly.

Thanks!

Edited by sensalim

Share this post


Link to post
Share on other sites



Perhaps:

(?i)p.*o.*b.*o.*x[\s|\.|\,|-]*(.*)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

What is (?i)

?

It doesn't work on my t-sql (This is actually for my project in microsoft sql server management studio)

This might be it:

(?<=x)\s*.*

Edited by sensalim

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0