Find and match all the quoted word in the given text. We can achieve this output in two ways.
"[^"]+"
looks for a quote "
followed by one or more non-quotes [^"]
, and then the closing quote "
.
Thoreau argues that people blindly accept "shams and delusions" as the "soundest truths", while regarding reality as "fabulous".
match | position |
---|---|
"shams and delusions" | 42 |
"soundest truths" | 72 |
"fabulous" | 118 |
Using the non-greedy pattern ".+?"
, we get the same output.
Thoreau argues that people blindly accept "shams and delusions" as the "soundest truths", while regarding reality as "fabulous".
match | position |
---|---|
"shams and delusions" | 42 |
"soundest truths" | 72 |
"fabulous" | 118 |
Find and match all the words with doubled letters in the given text.
Firstly, let match all the doubled letters with ([a-z])\1
. In this pattern, the combination of capturing group and back reference is used.
The successful bookkeeper's favorite paragraph: His sole child, my lord, and bequeathed to my overlooking. I have those hopes of her good that her education promises. Her dispositions she inherits, which makes fair gifts fairer; for where an unclean mind carries virtuous qualities, there commendations go with pity--they are virtues and traitors too. In her they are the better for their simpleness. She derives her honesty and achieves her goodness, happiness and respect.
match | position | $1 |
---|---|---|
cc | 6 | c |
ss | 9 | s |
oo | 16 | o |
kk | 18 | k |
ee | 20 | e |
oo | 99 | o |
oo | 134 | o |
rr | 257 | r |
mm | 291 | m |
oo | 348 | o |
tt | 374 | t |
ss | 397 | s |
oo | 443 | o |
ss | 448 | s |
pp | 454 | p |
ss | 459 | s |
And then extend the match up to the word boundary using \b
.
Find out why the word simpleness
is not matched here.
The successful bookkeeper's favorite paragraph: His sole child, my lord, and bequeathed to my overlooking. I have those hopes of her good that her education promises. Her dispositions she inherits, which makes fair gifts fairer; for where an unclean mind carries virtuous qualities, there commendations go with pity--they are virtues and traitors too. In her they are the better for their simpleness. She derives her honesty and achieves her goodness, happiness and respect.
match | position | $1 |
---|---|---|
successful | 4 | s |
bookkeeper | 15 | e |
overlooking | 94 | o |
good | 133 | o |
carries | 255 | r |
commendations | 289 | m |
better | 372 | t |
goodness | 442 | o |
happiness | 452 | p |