Re: JREPL.BAT v8.5 - regex text processor with support for text highlighting and alternate character sets
Posted: 12 Apr 2020 10:45
Why are you using word boundary \b anchors? That is why the ! after = is not replaced.
Why are you using delayed expansion? Delayed expansion won't help if the path contains spaces. Your paths should always be quoted, just in case there is a space. Without delayed expansion you don't have to worry about escaping !
I assume you are using /M because of the potential for null bytes in your content. If that is not an issue, then you can drop the /M.
Note that " cannot be passed as an argument to any CScript program like JREPL.BAT. You must use the \x22 escape sequence, or if you add the /XSEQ option you can use the non-standard \q escape sequence.
If you want to substitute _ for all 3 problem characters, you can simply do:
If you want to substitute a different character for each problem character, then you can use the /T option without any delimiter. Assume you want _ for !, ' for ", and # for :, then:
If you wanted to encode the problem characters in a way that can be reversed, then you can use the /T option with a delimiter - I'll use space as a delimiter. You could do something like _ --> _U, ! --> _B, " --> _Q, and : --> _C
Decoding is just as simple:
All that being said, I am concerned about your whole approach. I should think parsing your file with batch would only be plausible if all audio/video content is referenced by URL within your mxf. If any of the media content is embedded in your mxf then I should think all bets are off. Even if it can be done, batch seems like the worst possible option. Depending on what you are trying to do, JREPL might be a good choice for doing your actual parsing.
Dave Benham
Why are you using delayed expansion? Delayed expansion won't help if the path contains spaces. Your paths should always be quoted, just in case there is a space. Without delayed expansion you don't have to worry about escaping !
I assume you are using /M because of the potential for null bytes in your content. If that is not an issue, then you can drop the /M.
Note that " cannot be passed as an argument to any CScript program like JREPL.BAT. You must use the \x22 escape sequence, or if you add the /XSEQ option you can use the non-standard \q escape sequence.
If you want to substitute _ for all 3 problem characters, you can simply do:
Code: Select all
call jrepl "[!\q:]" "_" /xseq /m /f "%Linup%" /o "%dr%__lineup.mx"
Code: Select all
call jrepl "!\q:" "_'#" /t "" /xseq /m /f "%Linup%" /o "%dr%__lineup.mx"
Code: Select all
call jrepl "_ ! \q :" "_U _B _Q _C" /t " " /xseq /m /f "%Linup%" /o "%dr%__lineup.mx"
Code: Select all
call jrepl "_U _B _Q _C" "_ ! \q :" /t " " /xseq /m /f "%Linup%" /o "%dr%__lineup.mx"
All that being said, I am concerned about your whole approach. I should think parsing your file with batch would only be plausible if all audio/video content is referenced by URL within your mxf. If any of the media content is embedded in your mxf then I should think all bets are off. Even if it can be done, batch seems like the worst possible option. Depending on what you are trying to do, JREPL might be a good choice for doing your actual parsing.
Dave Benham