Complementing the response of the fernandosavio, another alternative is to use regex:
TdxBar[\s\S]+TAction
Instead of the point, I use [\s\S]
.
The brackets define a character class and match any character within them. For example, [ab]
means "the letter a
or the letter b
".
In case, inside the brackets we have:
Therefore, [\s\S]
is "anything that is space, line breaks, etc, or anything other than this". In short, this ends up corresponding to any character, including line breaks.
In the end, it ends up having the same effect of using .
along with the flag (?s)
(the point, by default, corresponds to any character except line breaks, and the flag (?s)
changes this behavior, making it also match line breaks).
I also use the quantifier +
, meaning "one or more occurrences". This makes it necessary to have at least one character between "Tdxbar" and "Taction".
If you use *
(zero or more occurrences), regex will also consider cases where there is nothing between them (i.e., if there is "Tdxbartaction" in the text, the regex with *
takes, but the with +
no, the +
requires there to be at least one character between them).
By default, quantifiers such as *
and +
sane greedy and try to pick up as many characters as possible. This means that if there are two occurrences of "Tdxbar" and "Taction", the regex will take the whole stretch between the first "Tdxbar" and the last "Taction"".
If you know that they only occur at most once in the text, and if you just want to know if one is before the other, there is no problem. But in case you want the regex to take all the sections separately, just cancel the greed using a ?
after the +
:
TdxBar[\s\S]+?TAction
Thus, the quantifier becomes lazy and tries to pick up as few characters as possible. See the difference: here the lazy quantifier finds 2 pouch, already here the greedy version finds only one match.
In what language will you use it?
– stderr
It would rotate in the sublime or in the Atom. It is to search to perform a correction
– Caputo