Documentation for regex simple and v2

A swapping-ground for Regular Expression syntax

Documentation for regex simple and v2

Postby lordlance » Mon Oct 24, 2022 10:51 am

I tried Googling on what exactly does regex simple and v2 mean but I can't seem to find proper documentation on them. For example my regex was:

(\w+)\s_(.*)


which shouldn't match with:

Alexandre Tansman Symphony No. 7 (1944) Oleg Caetani _ Melbourne Symphony Orchestra (152kbit_Opus).ogg


but it did for some reason. Why is regex matching partially by default? By default regex would accept match for the entire string (excluding extension) - at least in Java where I've learnt it that's the way it works.
lordlance
 
Posts: 6
Joined: Sun Aug 30, 2020 1:14 am

Regex versions

Postby Luuk » Tue Oct 25, 2022 3:28 am

Greetings lordlance.
There is an Operations Manual VOL-II that does give many examples, with using the different regexs.
So you can download the manual here... http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=12&t=5054.

The simple-checkbox is not really regex, so this manual is probably the only place that will document how it conducts?
It uses %# to say (.*?) in the Match, and %# to say \# in the Replace, but forbids conducting any regex meta-characters.

ALL regexs will partially match inside of a text-string, so even a "Match" like a will match any name with having an "a" inside!
The Simple and Regular regexs will delete any text outside of your match, so they are better for matching the whole ^Name$.
The "v2" regexs will only edit text that is inside of your match, so these can be better for editing smaller parts of your Name.

Some other main differences for v2, is that Replace should use $1 instead of \1 to say any of its group-numbers.
And Replace will grant case-modifiers like \u, \U, \l, \L, so like \u$1 uppercases the very 1st-character in $1.
The Match will also grant /modifiers, so like using a/gi can match all a's case-insensitive.
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Documentation for regex simple and v2

Postby Admin » Tue Oct 25, 2022 9:22 am

I also want to add that :

<<
The default Regular Expressions supported by Bulk Rename Utility are based on PCRE not on the newer PCRE2 library. To support version 2 of the Regular Expressions, enable the option 'v2'. This will enable support for Regular Expressions Version 2, which is based on the Boost RegEx and fully supports Perl Regular Expression to the latest version, ECMAScript and JavaScript.
There is also the option 'Simple' available to support a simple basic format for file name replacements, please see BRU help file for more info.
>>
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions


cron