I'm editing a text file - all lines end in 0D0A. Snippit of file is found below. I'm using Regular Expressions in TP 7.0.9.
I'm looking for lines with "m." followed by text and ";" in them. My find expression is ([^m\.]*)m\.([^;]*);(.*)\R (I've tried with and without "\R")
At line7, I expected the find to fail (no ";" before EOL) and move on - but it 'sees' the "m." and finds ";" in the next line! Obviously, I'm missing something. Can anyone identify?
sp:;Dorothy;b.Apr 1812;m.8 Sep 1828;d.4 May 1897)
2.;John;b.Abt 1831;d.Apr/Jun 1898)
sp:;Elizabeth;b.Abt 1830;m.10 Dec 1854;d.1907)
3.;Isabella;Wigham;b.Abt 1856)
4.;Margaret;Ann Hughes;b.Abt 1893)
4.;Harriett;Hughes;b.Abt 1897)
sp:;John;Lawson;m.Jan/Mar 1875)
4.;Elizabeth;Lawson;b.Abt 1876)
4.;Sarah;J. Lawson;b.Abt 1877)
3.;Sarah;Jane Wigham;b.Oct/Dec 1858;d.1941)
sp:;George;William Stoker;b.Abt 1857;m.Jan/Mar 1876;d.1891/1901)
4.;Elizabeth;Stoker;b.Abt 1878)
Find/Replace Goes Past Line End
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
[^m\.] (or [^m.] ) matches any character, including a newline, that isn't m or . (dot). That's why the matches can extend over newlines.
If you really need to capture the text matching the parenthesised parts of your regex then
([^m.\r\n]*)m\.([^;\r\n]*);(.*)
or
([^m.\r\n]*)m\.(.*?);(.*)
might do the trick. Otherwise a simple
m\..*;
might find the lines you're interested in.
If you really need to capture the text matching the parenthesised parts of your regex then
([^m.\r\n]*)m\.([^;\r\n]*);(.*)
or
([^m.\r\n]*)m\.(.*?);(.*)
might do the trick. Otherwise a simple
m\..*;
might find the lines you're interested in.
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm