The Possessive Quantification Chamber

Welcome, regex wizard, to the Possessive Quantification Chamber. Here, you will learn the ancient art of counting the number of possessives in a string.

But be warned, the path to enlightenment is fraught with danger. Your mind will be tested, your fingers will be worn to the bone, and your coffee will be cold.

Advanced Patterns

Example 1: The Possessive Quantifier

Using the possessive quantifier ('*'), you can match one or more of the preceding element. For example:

cat *s -> 1 match

cats *s -> 1 match

cat * -> 0 matches

Example 2: The Regex Possessive

Using the regex possessive ('+'), you can match one or more of the preceding element. For example:

cat +s -> 1 match

cats +s -> 1 match

cat + -> 0 matches

Example 3: The Secret Life of Possessives

But wait, there's more! Using the regex possessive ('*'), you can even match zero or more of the preceding element. For example:

cat *s -> 1 match

cats *s -> 1 match

cat * -> 0 matches

Back to the Possessive Quantification Chamber

Don't get lost in the examples! Return to the Possessive Quantification Chamber

Disclaimer

Using regex possessives can be hazardous to your mental health. Prolonged use can lead to chronic possessive anxiety, possessive fatigue, and a strong desire to use more parentheses than necessary.