regex help (how to match string with potential spaces or not)

T

titan nyquist

how can i match a string, of unknown length, when it may OR MAY NOT
contain spaces?

for example, these should all match "testing":

testing
test ing
t esting
t e s t i n g

i'm not sure how to set the regex... any help is appreciated

~titan
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

What about if you simply remove the spaces BEFORE matching it?

string s= "t e s t".Replace(" ","");
 
T

titan nyquist

exactly... i was thinking BACKWARDS... thank you for waking me up.

~titan
 

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

Top