Can I turn off multiline matching for wildcards?
I.e., when I use .* in a regex, I want the .* to only match within one line.
Can I turn off multiline matching?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Can't reproduce in TextPad 8.4.2, and as per regex defaults the dot matches anything but linebreaks. How is it possible for you having this problem at all?
Hint: using "Configure > Word Wrap" to display one original line in multiple virtual lines still doesn't make them multiple lines in real - that's only an optical feature (as can be seen by the line numbers) and out of scope for regular expressions.
Hint: using "Configure > Word Wrap" to display one original line in multiple virtual lines still doesn't make them multiple lines in real - that's only an optical feature (as can be seen by the line numbers) and out of scope for regular expressions.
Good question. I have Textpad 8.2.0 64-bit edition- about to upgrade it to see if that helps...AmigoJack wrote:Can't reproduce in TextPad 8.4.2, and as per regex defaults the dot matches anything but linebreaks. How is it possible for you having this problem at all?
Hint: using "Configure > Word Wrap" to display one original line in multiple virtual lines still doesn't make them multiple lines in real - that's only an optical feature (as can be seen by the line numbers) and out of scope for regular expressions.
Oh-- I'm sorry- I did mis-state the problem a little bit. The issue is when I search for a negated character group- then it includes new lines. I.e., if my file is this :
ab
cd
and when I search for :
a[^x]*d
Then it selects both lines. I couldn't figured out how to also exclude new lines...
Never mind though- got it to work. I re-started Textpad, then tried searching for :
a[^x\n]*d
and that couldn't find a match.
I was sure I had tried that before restarting Textpad and it would still select both lines. Maybe restarting Textpad helped- or maybe I'm a little crazy.
Thanks.
Again that is no TextPad related behaviour, but a default in regular expressions:
- The dot matches anything but newlines.
- Classes match everything, either inclusive or exclusive - that's why \n needs to be added to either something which should be included or excluded.
Last edited by AmigoJack on Thu Sep 24, 2020 8:55 pm, edited 1 time in total.
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
Oh yes, I meant \r instead of \p.
\p (and \P) are legit escape sequences for Unicode properties, if TextPad would support them.
\p (and \P) are legit escape sequences for Unicode properties, if TextPad would support them.
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
(this derails the topic, but)
I made my assumption from examples of something simple like \p{Pf} and \p{Greek} and \p{InHebrew}, which all gave me an error message about a wrong expression (instead of hinting it doesn't support the given property).
Neither the page I linked to, nor Perl itself lists a property named "digit", and unsurprisingly \p{digit} fails to match 一�, but that's the whole sense of Unicode properties: to i.e. match numbers of all languages, not just being another synonym of \d.
I made my assumption from examples of something simple like \p{Pf} and \p{Greek} and \p{InHebrew}, which all gave me an error message about a wrong expression (instead of hinting it doesn't support the given property).
Neither the page I linked to, nor Perl itself lists a property named "digit", and unsurprisingly \p{digit} fails to match 一�, but that's the whole sense of Unicode properties: to i.e. match numbers of all languages, not just being another synonym of \d.