Jump to content
Larry Ullman's Book Forums

Format Of End Of Regular Expressions

Recommended Posts

Hello everyone


I see that regular expressions in the book usually end with /i




However, on page 86 under point 7, the i is left off after the end forward slash:



Why has the i been left off in this instance?




Link to comment
Share on other sites

Welcome to the forum, Warwick.


The regex itself actually ends at the forward slash. The i after the forward slash is one of many possible modifiers that affects the entire regex. Specifically, the i meaning that the regex should search for strings in a case-insensitive fashion. The other common modifier you see for regexes is g, which is used for global searches (i.e., don't stop after the first match).


While for JavaScript, the following link might shed some light on things:


  • Upvote 1
Link to comment
Share on other sites


  • Create New...