regex optional whitespace characters 1

regex optional whitespace characters

// Add a \s? if a space can be allowed.
// \s stands for white space
// ? says the preceding character may occur once or not occur.
// If more than one spaces are allowed and is optional, use \s*.
// * says preceding character can occur zero or more times.


Here is what the above code is Doing:
1. # is the delimiter.
2. is the first group.
3. is the second group.
is the third group.

The first group is the link to the image.
The second group is the title of the image.
The third group is the alt text of the image.
The fourth group is the source of the image.
The fifth group is the height of the image.

Similar Posts