So I'm using jrepl to run a find and replace on a batch of files using regular expression. This is what I have:
Code: Select all
@echo off
echo begin find and replace
for %%F in (*.txt) do (
call jrepl "\r\n|STUDENT: [^\r\n]{1,200}|_[A-z].{1,300}|-{2,2000}"^
"\r\n\r\n|STUDENT:||" /m /x /t "|" /f "%%F" /o -
)
:end
echo Press any key to exit.
pause > nul
The bulk of which Dave Benham gave me, though I've added my own little bits to force the .bat to pause instead of automatically closing so I can see the error messages and such that pop up.
Basically, it seems to only want to run '-{2,2000}' replaced with nothing - the rest of the regex doesn't seem to work.
If I try and edit it down to just running the first (\r\n replaced with \r\n\r\n) I get "JScript runtime error: Mismatched search and replace /T expressions" for both the files I'm testing on.
The find and replaces I'm trying to run, for better readability, are as follows:
FIND: \r\n
REPLACE: \r\n\r\n
FIND: STUDENT: [^\r\n]{1,200}
REPLACE: STUDENT:
FIND: _[A-z].{1,300}
REPLACE: [nothing]
FIND: -{2,2000}
REPLACE: [nothing]
These are designed to add double paragraph breaks, remove any student dialogue (these are transcripts of classroom recordings), find and replace essentially the first 300 characters (which is a bunch of header stuff we don't need), and then remove any dashes that aren't singular, up to 2000 in a row (also part of the header/footer of the original documents, avoiding removal of dashes in hyphenated words).
Hope all of this makes sense. Ask as many questions as you need, but I'm totally lost. (cue internal rage at employers for expecting me to be able to do things I have no training in).