Page 1 of 1

Pattern match excluding spaces???

Posted: Sun May 22, 2011 10:00 am
by ezinestein
Hello again,

As always, thank you for your help! I will usually spend a couple hours trying to figure something out, but then as a last resort I come here for help. I hope that's ok.

Is there a way to pattern match a line that has spaces... when the words I have do not have spaces?

Here is what I mean...

If I have a phrase like... 'california traffic school' in a text file... and I'd like to extract it... but all I have in another text file is that phrase minus the spaces... like... 'californiatrafficschool'...

Is there a way for me to extract the phrase with spaces using the matching phrase I have is without the spaces?

So again, I have this... 'dogtrainingvideos' and I'd like to extract the same phrase from a file... but the phrase has spaces between words like... 'dog training videos'.

Thank you.

Regards,
ed

Re: Pattern match excluding spaces???

Posted: Mon May 23, 2011 11:25 am
by DataMystic Support
Hi Ed,

Not, you can't do this. You would have to pre-process the file with 'california traffic school' in it so that it becomes
'californiatrafficschool', perhaps add line numbers, and then run the matching filter against it for californiatrafficschool.

Another approach would be to generate a file with 2 fields - e.g.

"california traffic school","californiatrafficschool"
"dog training videos'","dogtrainingvideos"

Then you can replace each match with, say, ##FOUND##, and then extract just those lines.