1

I'm using EditPad 7 to edit some text and using regular expressions within the find and replace. I am trying to find only words at the end of the line.

Ex:

Wrapper:H
Wrapper:H Binder:G
Wrapper:Honduras

I want to find the capital H on the first line not the second or third line.

CaffGeek
  • 21,856
  • 17
  • 100
  • 184
Jeremy
  • 3,620
  • 9
  • 43
  • 75

2 Answers2

2

Either H$ or H\Z should work.

See http://www.regular-expressions.info/reference.html for more info

CaffGeek
  • 21,856
  • 17
  • 100
  • 184
1

I don't know whether EditPad works in multi-line mode or not. If it does use this to find:

(Wrapper:)H$

and this to replace:

\1whateveryouwanttohaveinstead

Also, if you want to disregard additional whitespace between H and the end of the line (i.e if whitespace does not make not the end of the line), you can use this:

(Wrapper:)H\s*$
Martin Ender
  • 43,427
  • 11
  • 90
  • 130
  • I don't think `(Wrapper:)H([\r\n])` works. At least it doesn't when I test it. – CaffGeek Oct 16 '12 at 15:28
  • Hm okay, but apparently EditPad works in multiline mode, so the first version should be all right. I'll just remove the second part. – Martin Ender Oct 16 '12 at 15:29
  • 1
    EditPad is always in multiline mode (no reason not to be, for a text editor), and `H$` and `H([\r\n])` both match the first `H` in the OP's sample string when I try them. Of course, if the line separator happens to be CRLF (i.e., Windows mode), it only consumes the CR, not the LF. – Alan Moore Oct 16 '12 at 16:16
  • @AlanMoore yeah I would have expected EditPad to be in multiline mode, but I couldn't test it, so I didn't assume it. And for `\r\n`, my code sample using `[\r\n]` put the group containing that character back in place, so it wouldn't have mattered if it was half a line break or a full one. – Martin Ender Oct 16 '12 at 17:12