-1

I have a string - howareyoumyworld Using RegEx, I only want to match the string till the nearest w i.e. I want to match how and not howareyoumyw.

Please help!

  • 1
    Try `^[^w]*w` or `^.*?w`. – Cary Swoveland May 15 '20 at 05:56
  • 1
    Does this answer your question? [Regex: matching up to the first occurrence of a character](https://stackoverflow.com/questions/2013124/regex-matching-up-to-the-first-occurrence-of-a-character) – Nick May 15 '20 at 05:59

1 Answers1

0

You can use lazy quantifier ?

^\w+?w
Derviş Kayımbaşıoğlu
  • 26,360
  • 3
  • 47
  • 64