Korzystanie z Regex w JavaScript
//Adding '/' around regex
var regex = /\s/g;
//or using RegExp
var regex = new RegExp("\s", "g");
TC5550
//Adding '/' around regex
var regex = /\s/g;
//or using RegExp
var regex = new RegExp("\s", "g");
preg_match("/^([a-zA-Z' ]+)$/","Given_Name");
/[A-Z]/ : 'must contain one uppercase'
/([a-z])/ : 'must contain one lowercase'
/(\d)/ : 'must contain one number'
/(\W)/ : 'must contain one special character'
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,10}"
/findme/
Characters \, ., \cX, \d, \D, \f, \n, \r, \s, \S, \t, \v, \w, \W, \0, \xhh, \uhhhh, \uhhhhh, [\b]
Assertions ^, $, x(?=y), x(?!y), (?<=y)x, (?<!y)x, \b, \B
Groups (x), (?:x), (?<Name>x), x|y, [xyz], [^xyz], \Number
Quantifiers *, +, ?, x{n}, x{n,}, x{n,m}
Unicode \p{UnicodeProperty}, \P{UnicodeProperty}
javascript
let re = /findme/
let defaults = new RegExp('compiled');
defaults = { dotAll: false, flags: "", global: false, ignoreCase: false, falselastIndex: 0, multiline: false, source: "abc", sticky: false, unicode: false}
Hello World as a regular expression.
Replaces everything with "Hello World".
For use with vi, sed, etc.
Search String : ^.*$
Replace String: 'Hello World'