EDIT I've noticed that when I use /m I expected the entire text to be acted upon as one string.
The text has *** in several places and then .* is no longer greedy - it doesn't match until the last occurrence.
Code: Select all
@echo off
(
echo(aaa
echo(
echo(***
echo(
echo(bbb
echo(
echo(***
echo(
echo(
echo(***
echo(
echo(
echo(*** ***
echo(ZZZ
)>accounts.txt
:remove text at bottom from last *** and onward
echo ======
call jrepl "(.*)\*\*\*[\s\S]*" "" /m /f accounts.txt
echo ======
pause
This is what I see
======
aaa
======
Did I fail to grasp how /m works??
Original post follows:
Can you quickly comment on why .* doesn't match all characters and [\s\S]* does match all characters?
Is it something to do with line endings?
This top version similar to yours works but the lower one doesn't. I'm trying to understand why.
Code: Select all
call jrepl "^\*\*\*[\s\S]*" "" /m /f accounts.txt
call jrepl "^\*\*\*.*" "" /m /f accounts.txt