Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v1) • Re: From RegExMatch to RegExReplace

$
0
0

But the dot is then at the beginning of the line and not at the end.


Your needle is different than the one I posted. Notice the capture groupings. My needle places the dot before the LF, not after it as yours does.

Also, the trailing \s can match end of line characters which will also put the dot on next line if a CR is also included before LF. This is why I prefer \h instead of \s. I could be wrong and unable to test from my phone. But see if this is the case? If this is the case, change \s to \h in the needle I provided and test it. (Changing it in your needle will still place the dot at beginning of the line.) You might want to also use \R instead of \n if these are actual lines.

strText := RegExReplace(strText, "(\n[A-Z]\h*[a-Z\h]*)(\n)", "$1\.$2")

You could also use the ^ and $ anchors (with multi-line option as needed), but I assume you are intentionally using the LF for a reason. Like as a delimiter, rather than end of line.

Statistics: Posted by andymbody — Today, 15:45



Viewing all articles
Browse latest Browse all 579

Trending Articles