Very new to regex

A swapping-ground for Regular Expression syntax

Very new to regex

Postby lordlance » Sat Jul 30, 2022 7:36 am

I have been learning RegEx through my Java course and wanted to test a very simple renaming scheme:

Image

I was trying to replace all possible case inconsistencies through the use of [] but it does not seem to work. The BRU documentation lists [] as the OR syntax too so I am not sure what I am doing wrong.
lordlance
 
Posts: 6
Joined: Sun Aug 30, 2020 1:14 am

Case insensitive matching

Postby Luuk » Sat Jul 30, 2022 8:32 am

Replace(3) will not grant saying any regular expressions, so the "Replace" and "With" would need to look more like...
KaRAjan|KARAJAN|kArajaN|kaRaJan|KarajaN|KaRajan|...
karajan

But with Regex(1), the "Match" and "Replace" can look many different ways, like...
(.*)[kK][aR][rR][aA][jJ][aA][nN](.*)
\1karajan\2

(.*)(?i)karajan(.*)
\1karajan\2

If putting a checkmark inside of "v2", then you only have to match the parts that you want to change, so more like...
(?i)karajan
karajan

(?i)(karajan)
\L$1

The (?i) says to match either case, and \L says to lowercase everything that was matched.
The (?i) can also be turned off with (?-i) if its no longer to be needed inside of the "Match".
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm


Return to Regular Expressions