Theme Layout

Boxed or Wide or Framed

Wide

Theme Translation

Display Featured Slider

Featured Slider Styles

Display Grid Slider

yes

Grid Slider Styles

Display Trending Posts

Display Author Bio

Display Instagram Footer

off

Dark or Light Style

Light

Blog Archive

Powered by Blogger.

Wednesday, February 22, 2017

[JavaScript] Regular Expressions


# JavaScript Regular Expressions


A regular Expression is a sequence of characters that forms a search pattern. The search pattern can be used for text search and text replace operations.

● Using String Methods

In JSP, regular expression to search for a match, and returns the position of the match.
The search() method uses an expression to search for a match, and returns the position of the match.
The replace() method returns a modified string where the pattern is replaced.

● Using String  search() With a Regular Expression

● Using String search() With String

The search method will also accept a string as search argument. The string argument will be converted to a regular expression.

● Using String replace() With String

The replace() method will also accept a string as search argument.

● Regular Expression Modifiers

Modifiers can be used to perform case-insentive more global searches.

https://www.w3schools.com/js/js_regexp.asp

● Regular Expression Patterns

Brackets are used to find a range of characters.

https://www.w3schools.com/js/js_regexp.asp

Metacharacters are characters with a special meaning.

https://www.w3schools.com/js/js_regexp.asp

Quantifiers define quantities.

https://www.w3schools.com/js/js_regexp.asp

● Using the RegExp Object

In JavaScript, The RegExp Object is a regular expression object with predefined properties and methods.

● Using test()

The test() method is a RegExp expression method.
It searches a string for a pattern, and returns true or false, depending on the result.
The following example searches a string for the character "e".

● Using exec()

The exec() method is a RegExp expression method.
It searches a string for a specified pattern, and returns the found text.
If no match is found, it returns null.
The following example searches a string for the character "e".









QuickEdit
Unknown
0 Comments
Share This Post :

You Might Also Like

No comments:

Post a Comment

Follow @SunriseSunsetBlog