JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
sk8ordie
Posts: 13
Joined: 10 Feb 2021 03:56

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#511 Post by sk8ordie » 12 Nov 2021 14:57

I need a little help again :oops:
in a result.txt file, there is always one link, after _ps with a random numbers, and always a known numbers to insert 0000100
could all this be done with jrepl or just finding the numbers?

result.txt

Code: Select all

https://stream9.nava.hu/navahu_bdrm/_definst_/amlst:mnfa-84/manifest_w634869604_ps3854000_pd60000000_qc2Vzc2lkPSZvbXE9dHJ1ZSZucD0mbGI9NTdoN1dqVDg5N2VXVnVLUnhhQk9BYzJmS2JKWSUyQlhudGtNQXhSRWxET3BDc0ttR055T2FlRGJSbFQ5SGQyMzZ6MFpReXpmTVlBSlFMJTBEJTBBbEFxWmlOeFBqQSUzRCUzRCUwRCUwQQ==.mpd
to finding numbers i only managed to get this far
https://regex101.com/r/iv5qpv/1/
(I could not get the letter s off)

target.txt

Code: Select all

https://stream9.nava.hu/navahu_bdrm/_definst_/amlst:mnfa-84/manifest_w634869604_ps0000100_pd60000000_qc2Vzc2lkPSZvbXE9dHJ1ZSZucD0mbGI9NTdoN1dqVDg5N2VXVnVLUnhhQk9BYzJmS2JKWSUyQlhudGtNQXhSRWxET3BDc0ttR055T2FlRGJSbFQ5SGQyMzZ6MFpReXpmTVlBSlFMJTBEJTBBbEFxWmlOeFBqQSUzRCUzRCUwRCUwQQ==.mpd

aGerman
Expert
Posts: 4325
Joined: 22 Jan 2010 18:01
Location: Germany

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#512 Post by aGerman » 13 Nov 2021 06:04

I don't think you need to exclude the _ps from the match. Just include it in your replace string again. So, I guess what you want to do is replacing
_ps[0-9]+ with _ps0000100, right?

https://regex101.com/r/uT2dbP/1

Steffen

sk8ordie
Posts: 13
Joined: 10 Feb 2021 03:56

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#513 Post by sk8ordie » 13 Nov 2021 06:39

yes, it's good as it is, but how does the program find its way back?
if _ps is out of it?
it have no clue where to put the 0000100 numbers back, or am I getting something wrong?

aGerman
Expert
Posts: 4325
Joined: 22 Jan 2010 18:01
Location: Germany

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#514 Post by aGerman » 13 Nov 2021 06:47

Not sure what you're asking, honestly. _ps is not out of it as I've shown in the regex101 example. The main purpose of JREPL is replacing. This thread is full of examples. Do you have problems to understand the help documentation of JREPL?

Steffen

sk8ordie
Posts: 13
Joined: 10 Feb 2021 03:56

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#515 Post by sk8ordie » 13 Nov 2021 06:53

aGerman wrote:
13 Nov 2021 06:47
Not sure what you're asking, honestly. _ps is not out of it as I've shown in the regex101 example. The main purpose of JREPL is replacing. This thread is full of examples. Do you have problems to understand the help documentation of JREPL?

Steffen
ohh okay, now i get it :)
thank you for the guidance!

that's was a solution:

Code: Select all

@echo off
setlocal enabledelayedexpansion
set "int=_ps[0-9]+"
set "int_new=_ps0000100"
for %%i in ("result.txt") do (
    call jrepl "!int!" "!int_new!" /m /f "result.txt" /o "target.txt"
)

aGerman
Expert
Posts: 4325
Joined: 22 Jan 2010 18:01
Location: Germany

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#516 Post by aGerman » 13 Nov 2021 07:14

Huh, what is this loop for?

sk8ordie
Posts: 13
Joined: 10 Feb 2021 03:56

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#517 Post by sk8ordie » 13 Nov 2021 09:04

yes, indeed the loop is pointless there
just found it in an example and it worked, so I didn't touch it

aGerman
Expert
Posts: 4325
Joined: 22 Jan 2010 18:01
Location: Germany

Re: JREPL.BAT v8.6 - regex text processor with support for text highlighting and alternate character sets

#518 Post by aGerman » 13 Nov 2021 09:35

Copy pasta has a rotten taste. It's critical to understand the code you're using.

Post Reply