INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Expression Language wish list  (Read 246 times)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2433
Expression Language wish list
« on: January 23, 2024, 04:12:44 am »

(Reviving this thread for MC32)

New Replace() modes 2 and 3 with regex:
Replace(text, SearchRegex, ReplaceStr, 2) - regex replace, ignore case
Replace(text, SearchRegex, ReplaceStr, 3) - regex replace, case sensitive

Examples (using standard PCRE syntax):

Replace(He was born in 07-20-1941, \d+-\d+-, , 2)
output: He was born in 1941

Replace(He was born in 07-20-1941, (\d+)-(\d+)-(\d+), $2.$1.$3, 2)
output: He was born in 20.07.1941
demo: https://regex101.com/r/65Luzn/1

Replace(Metallica released "Load" in 1996 and "Reload" in 1997, "(.+?)", "<font color=#FF0000>$1<//font>", 2)
output: Metallica released "Load" in 1996 and "Reload" in 1997
demo: https://regex101.com/r/dQaCNJ/1
Logged
Pages: [1]   Go Up