![enclose character word enclose character word](https://i.pinimg.com/originals/34/e3/48/34e348ff8861a166843d4f5780360fe5.png)
We need to use the zero-or-more quantifier (*) after the square brackets to indicate that we’d like to match an expression of any length: / * / Basically this will match everything except the letter a: / /īy itself, the expression above will match only the first character that is not the letter a. This indicates a negated set which is used to indicate what not to match. The expression starts with the letter a enclosed in square brackets, and with a caret symbol (^) as the first character inside the square brackets. The following regular expression will return everything after the last occurrence of the letter “a”: / * $ / So in summary, the regular expression above matches zero-or-more whitespace and non-whitespace characters after the letter “a” up to the end of the string, and returns it as capture group 1.ĪLSO READ: Regex Match Everything Except a Specific Word, Character, or Pattern Method 2: Match everything after last occurence
![enclose character word enclose character word](https://i0.wp.com/dellwindowsreinstallationguide.com/wp-content/uploads/2020/05/image-27.png)
It’s similar to the dot character (.) which matches everything except new-lines. So essentially, the \s\S combination matches everything.
![enclose character word enclose character word](https://i1.wp.com/www.myofficetricks.com/wp-content/uploads/2019/09/image-14.png)
while non-whitespace characters include all letters, numbers, and punctuation. Whitespace characters include spaces, tabs, linebreaks, etc. We start the expression by listing the character we want to extract after (in this case the letter a): /a /Īfter this character, we specify that we’d like to match all whitespace characters (\s) and all non-whitespace characters (\S). The following regular expression will return everything following the first occurrence of the character “a”. Method 1: Match everything after first occurence Some methods search for whitespace and non-whitespace characters following the character, while other methods make use of positive look-behinds. For instance, you’d like to extract the query string from a URL, which follows a question mark.Ī regular expression that matches everything after a specific character can be written in more than one way. Sometimes we’d like to extract everything from a body of text that follows a specific character.