Getting started with Regular Expression/REGEX

Pronounced as Regex or rejex?

probably is the most dificult thing to answer, But i will go with Regex as it stands for Reguar Expression

Why use Regex?

  1. Validate Text
  2. Search through text

builtin functions in js to write regex

Regex strings starts and ends with / and if there is extra information needed, we can use regex flags after the ending / like this //g the g here is a flag

Special Regex Characters

These are all the Special characters.

.^&*+-?()[]{}\|

Flags

are written at the right side of the / like so //g The g flat turns it into a global, which will make it search for multiple matches

visit regexr.com for more. it has amazing cheatsheet and traning area.

\[ \begin{aligned} KL(\hat{y} || y) &= \sum_{c=1}^{M}\hat{y}_c \log{\frac{\hat{y}_c}{y_c}} \\ JS(\hat{y} || y) &= \frac{1}{2}(KL(y||\frac{y+\hat{y}}{2}) + KL(\hat{y}||\frac{y+\hat{y}}{2})) Let's begin with a eulers formula, $e^{i\pi + 1} = 0$. \end{aligned} \]

This is an inline \(a^*=x-b^*\) equation.

These are block equations:

\[a^*=x-b^*\] \[ a^*=x-b^* \] \[ a^*=x-b^* \]

These are block equations using alternate delimiters:

$$a^*=x-b^*$$ $$ a^*=x-b^* $$ $$ a^*=x-b^* $$