Basic Regex

Estimated reading time: 1 minute

basic

/a/
// kamal is the developer of code4mk organization.

first

^ tick means select from first

/^ka/
// kamal is the developer of code4mk organization.

last

$ last position

/ion$/

dot

dot is decimal point.

  • it count space as a position.
/..oper/
/.oper/
//kamal is the developer of code4mk organization.

escape

\ blackslash use for escape specialess ({ } [ ] / \ + * . $ ^ | ?)

/\*al/
//kam*l is the developer of code4mk organization.

plus

/be+/
// be
// bee
// bebe
// beeeeeebee
// beee

optional

/colou?/
// color
// colour

alternate

| pipe / or / alternate

/red|blue/
// red
// blue
// green
regex, js