J. Doe J. Doe - 1 year ago 78
Ruby Question

How to improve my RegEx to get the text before the pattern?

For example I have the next text:

Hello, my name is %{John}.

Now, I want to take all text before
. For this I'm using the next RegEx:


It works, but it includes
this part too. I do not need that. How can I take whole text, but exclude

Answer Source

Try this:


see http://www.rubular.com/r/YHcuSxMIA8

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download