python get secon match of regex code example
Example 1: python string match ignore case
if firstStr.lower() == secStr.lower():
print('Both Strings are same')
else:
print('Strings are not same')
Example 2: javascript regex example match
//Declare Reg using slash
let reg = /abc/
//Declare using class, useful for buil a RegExp from a variable
reg = new RegExp('abc')
//Option you must know: i -> Not case sensitive, g -> match all the string
let str = 'Abc abc abc'
str.match(/abc/) //Array(1) ["abc"] match only the first and return
str.match(/abc/g) //Array(2) ["abc","abc"] match all
str.match(/abc/i) //Array(1) ["Abc"] not case sensitive
str.match(/abc/ig) //Array(3) ["Abc","abc","abc"]
//the equivalent with new RegExp is
str.match('abc', 'ig') //Array(3) ["Abc","abc","abc"]
Example 3: regex to get part of word nodejs
/\(\{#(.*?)#\})\)/g.exec("({#test#})")[1] === "test"