String of 12 digits delimited by +

Post any Bulk Rename Utility support requirements here. Open to all registered users.

String of 12 digits delimited by +

Postby torredipisa » Mon May 13, 2024 3:40 pm

Hi everyone

I want to retrieve all the filenames which contain a string of 14 digits deimited by the char +.
For example:
[Airbus] [A320-232] [Sx-Dvk] [Aegean-Airlines] +20160710092313+
[Cessna] [560xl-Citation-Xls] [D-Cefo] [Air-Hamburg] +20150421-072804+
Could you kindly let me have some suggestion?

Thanks and regards.
Fabio
torredipisa
 
Posts: 15
Joined: Thu Jul 28, 2022 11:28 am

Re: String of 12 digits delimited by +

Postby torredipisa » Mon May 13, 2024 4:49 pm

torredipisa wrote:Hi everyone

I want to retrieve all the filenames which contain a string of 14 digits deimited by the char +.
For example:
[Airbus] [A320-232] [Sx-Dvk] [Aegean-Airlines] +20160710092313+
[Cessna] [560xl-Citation-Xls] [D-Cefo] [Air-Hamburg] +20150421072804+
Could you kindly let me have some suggestion?

Thanks and regards.
Fabio
torredipisa
 
Posts: 15
Joined: Thu Jul 28, 2022 11:28 am

Re: String of 12 digits delimited by +

Postby therube » Mon May 13, 2024 4:57 pm

Your second example does not match what you said (as it has a - in there).

\+\d{14}?\+
will find 14 digits delimited by +


Then what are you wanting to do with that?
If only searching, 12:Filter, then \+\d{14}?\+ (which says to find 14 digits, delimited by +)

If that string appears at the end of the filename, you can match it with RegEx.
(Replace: depends on what you're looking to do.)

1:RegEx
Code: Select all
Match:  (.*)(\+\d{14}?\+)$
Replace: 
therube
 
Posts: 1333
Joined: Mon Jan 18, 2016 6:23 pm

Re: String of 12 digits delimited by +

Postby torredipisa » Mon May 13, 2024 5:17 pm

Thank you for ys swift reply.
Sorry for the incorrect text i wrote.
One question. I tried many times to understand RegEx but with scarce results.
For example, what is the meaning of:
\+\d{14}?\+
I understand 14 is just the number of digits and + is the delimiting char, but
what exacly \d and ? are for?
Is possible to find somewhere a RegEx guideline which is not the official one
(which for me is quite unattainable).
Thanks for yr kind help.
Regards
Fabio
torredipisa
 
Posts: 15
Joined: Thu Jul 28, 2022 11:28 am

Re: String of 12 digits delimited by +

Postby therube » Mon May 20, 2024 4:06 pm

(not that i understand it too much, but...)

\+, a literal plus sign (the \ escapes any other meaning the + may otherwise have)
\d, signifies a digit, {14}, says 14 of them, digits, {1,14} would be a range of 1..14 digit(s) ...
?, oh, i don't remember, only that something funky was going on & the ? helped ;-)
\+ again a literal plussignhttps://www.geeksforgeeks.org/perl-regex-cheat-sheet/

(I had a different site that I used to go to, but I seem to have lost it from my browser history, & I'm not coming up with it again?)

Ah, here it is but only on googlecache ?, PCRE Regex Cheatsheet.

And here it is (now) outside of cache, JavaScript Regex Cheatsheet.
(Seems part of his site does not work properly in my browser.)
therube
 
Posts: 1333
Joined: Mon Jan 18, 2016 6:23 pm

Re: String of 12 digits delimited by +

Postby Admin » Tue May 21, 2024 2:08 am

See also : Getting help with Regular Expressions on the BRU forum.
Admin
Site Admin
 
Posts: 2391
Joined: Tue Mar 08, 2005 8:39 pm


Return to BRU Support