0

I am using EditPad, but generally Perl regular expression work for it. I am trying to find only the first occurrence of a pattern per line in editpad.

Ex: Searching for number 1 in 947319949194 I only want the first 1 found, not the second.

Jeremy
  • 3,620
  • 9
  • 43
  • 75

1 Answers1

1

I believe (in Perl) the first occurrence of 1 per line should be found by regex /^[^1\n\r]*(1)/m

Ωmega
  • 42,614
  • 34
  • 134
  • 203
  • Quick on the draw Omega, I was halfway through it. – Ccorock Sep 28 '12 at 21:06
  • 1
    @Ccorock - Multiline mode - see http://www.regular-expressions.info/modifiers.html – Ωmega Sep 28 '12 at 21:23
  • In EditPad, multiline mode is the default--you can't even turn it off like you can with other options. (Why would you want to?) You don't need regex delimiters, either. – Alan Moore Sep 28 '12 at 22:44
  • @AlanMoore - Thank you for that information. Because I was not sure about EditPad defaults and syntax, I explicitely wrote in my answer that the solution is Perl regex. – Ωmega Sep 28 '12 at 23:47