Online
 
Friday, 05 December 2008
 
 

JavaScript - Anchoring match position | Print |  E-Mail
 

Anchoring match position

An anchor in a regular expression matches a position in a string (such as the beginning or the end of the string) without matching any of the characters of a string. It can be used to restrict (or anchor) a match to a specific position within a string.

Character

Meaning

^, $

Require match at beginning/end of a string, or in multiline mode, beginning/end of a line

\b, \B

Require match at a word boundary/non-boundary

(?=p)

Look-ahead assertion: require that the following characters match the pattern p, but do not include them in the match. (JS 1.5)

(?!p)

Negative look-ahead assertion: require that the following characters do not match the pattern p. (JS 1.5)

 

This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Rokok Kretek Jumbo Coklat

“Terbuat dari tembakau, saos dan cengkeh pilihan kwalitas tinggi sehingga menghasilkan rokok dengan rasa yang cocok untuk segala cuaca”
Jumbo Coklat - Powered By G-Ads

 
Top! Top!