having problems capturing all text possibilites.

  • Thread starter Alexandre Brisebois (www.pointnetsolutions.com)
  • Start date
A

Alexandre Brisebois (www.pointnetsolutions.com)

Hi I'm trying to fix an expression, to grab all sets of 2 words with a
space between them, ie: hello word (valid) C# sample (Valid) hello.
world (Invalid) hello world. (invalid) <-- need to stop capture before
the "." and cannot use \b since \b includes "#"

this is the expression I am trying to work with, so far it takes each
word fine seperately, but it does not take into account hello. world
and it captured hello world.


(([\x23\x41-\xff]*\x2e?[\x23\x41-\xff]+)(?:[\x21-\x2f\x41-\xff])?\s([\x23\x­41-\xff]*\x2e?[\x23\x41-\xff]+)(?:[\x21-\x2f\x41-\xff])?)



the other problem is that it only takes pares sequentially,


I would need to have it do the follwing


hello world this is time


(hello word) (world this) (this is) (is time)


can anyone help me out.


Best Regards,
Alexandre Brisebois
http://www.pointnetsolutions.com
 
B

Bruce Wood

Is there a particular reason why you need to use a single Regex for
this when applying two or three Regex expressions in code would work
better? By that I mean, match a word, match spaces after it, then match
another word, then start again from the beginning of the second word?

Trying to do it all in one go just seems unnecessarily difficult to me.
 
A

Alexandre Brisebois (www.pointnetsolutions.com)

I have solve the problem with queue type adt
and I just feed words one by one into them,
and simply call a overriden ToString()

works pretty well actually.
so I am working by grabbing each word one by one.
I still have some problems though so I will look info refining
the way I clean html out of files and a list of specific characters

then I match single words...

still needs optimization though.

Best Regards,
Alexandre Brisebois
 

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