Page 6 of 7

Re: A bit of regex help needed

Posted: 20 Jun 2015 13:24
by highend
First case:

Code: Select all

Intr > 
There is a space after the >!

Second case:

Code: Select all

Intr > Ex
But I don't see the need to use a regex here, search & replace would be able to do the same. But nevertheless, no special syntax necessary :)

Re: A bit of regex help needed

Posted: 20 Jun 2015 13:43
by eil
em.. none of those work for selecting multiple files and pushing F2 :(

Re: A bit of regex help needed

Posted: 20 Jun 2015 13:51
by highend
You asked for a regex pattern. Ofc you have to use regexp rename... :)

Re: A bit of regex help needed

Posted: 20 Jun 2015 14:55
by eil
oh, now i see. for some reason i thought this form already includes batch + regex depending what you state in input. seems like i'll have to reassign my shortcuts for rename.) or maybe there is a way to state what kind of F2-rename i want when many files are selected?(as i see F2 is for simple rename but when many files selected Batch comes in place, thogh it's assigned to Shift+F2

Re: A bit of regex help needed

Posted: 20 Jun 2015 15:00
by highend
You mean batch rename? No.

You have to use either regexp rename... or search & replace...

My pattern was for the regexp variant but your "problem" can easily solved by search & replace... as well.

Re: A bit of regex help needed

Posted: 21 May 2016 21:58
by tiago
look for\search text
\s

replace with\replacement text
a/\n

This works fine but with each document's last line. Which 'look for' I could use so the entire document is done on a single pass?

edit: it turns out the replacement generates <lf> separated lines, not <crlf>. How could I fix this too?

Re: A bit of regex help needed

Posted: 21 May 2016 22:08
by highend
I don't understand...

Show a screenshot of what is happening and what should have happened...

Re: A bit of regex help needed

Posted: 21 May 2016 22:15
by tiago
Sure.
Please consider the edit I did.
a\r\n solves the <crlf> problem I guess.
expected Result.png

Re: A bit of regex help needed

Posted: 21 May 2016 22:35
by highend
You want to replace all line ending u's with a's in the whole document?

Search for: u$
Replace with: a

Re: A bit of regex help needed

Posted: 21 May 2016 22:48
by tiago
Yes.
Being the problem the last line of each document.

Re: A bit of regex help needed

Posted: 21 May 2016 22:55
by highend
$ matches each line ending, even the one of the last line so what I suggested should work

Re: A bit of regex help needed

Posted: 21 May 2016 23:03
by tiago
Worked. Thank you!

Re: A bit of regex help needed

Posted: 25 Jun 2016 23:26
by tiago
Input:
? h4\static\Windows\win32\Manifests\x86_microsoft-windows-ndisuio.resources_31bf3856ad364e35_6.1.7600.16385_pt-br_9dc57ae50d7ad254.manifest
d4\optim\Windows\winsxs\x86_ph3xibc9.inf_31bf3856ad364e35_6.1.7600.16385_none_4482afc18dfa7358
! r3\static\Windows\win64\x86_netgb6.inf_31bf3856ad364e35_6.1.7600.16385_none_33c0abd150a8143e

Output:
? h4\static\Windows\win32\
d4\optim\Windows\winsxs\
! r3\static\Windows\win64\

How can I get this using regexreplace sc, please?

Re: A bit of regex help needed

Posted: 25 Jun 2016 23:32
by highend
Nothing easier than that:

Code: Select all

    $a = <<<>>>
? h4\static\Windows\win32\Manifests\x86_microsoft-windows-ndisuio.resources_31bf3856ad364e35_6.1.7600.16385_pt-br_9dc57ae50d7ad254.manifest
d4\optim\Windows\winsxs\x86_ph3xibc9.inf_31bf3856ad364e35_6.1.7600.16385_none_4482afc18dfa7358
! r3\static\Windows\win64\x86_netgb6.inf_31bf3856ad364e35_6.1.7600.16385_none_33c0abd150a8143e
>>>;

    text regexreplace($a, "^((?:.*?\\){4})(.*?$)", "$1");

Re: A bit of regex help needed

Posted: 26 Jun 2016 00:06
by tiago
Hello, highend! Thanks for the prompt reply on this busy saturday I'm having.
As far as I can tell your code splits elements to the first 4 tokens '\' divided, right?
Say I'd need to state manually

? h4\static\Windows\win32\Manifests\
or
d4\optim\Windows - yes, no '\' here.
or
! r3\static\

what could I do?