You are here: PSPad forum > English discussion forum > Why does this regex require an additional "case-sensitive" option?

Why does this regex require an additional "case-sensitive" option?

#1 Why does this regex require an additional "case-sensitive" option?

Posted by: maki | Date: 2019-07-02 10:44 | IP: IP Logged

Why does this regex require an additional "case-sensitive" option?
Like a different regex, but it also has the same application, so why are there two types?
[A-Z] = big and small letter match
[a-z] = big and small letter match

Options: Reply | Quote | Up ^


#2 Re: Why does this regex require an additional "case-sensitive" option?

Posted by: pspad | Date: 2019-07-02 12:13 | IP: IP Logged

Case sensitive option is part of the regular expression. You can switch it on/off.
PSpad does it in Search dialog, if you use regular expressions in script, you need to set it by your own

Options: Reply | Quote | Up ^


#3 Re: Why does this regex require an additional "case-sensitive" option?

Posted by: maki | Date: 2019-07-02 14:46 | IP: IP Logged

(i?)[A-Z]
(?-i)[A-Z]

(?i) case-insensitive mode ON
(?-i) case-insensitive mode OFF

How to find only capital word?

Edited 1 time(s). Last edit at 2019-07-02 14:48 by maki.

Options: Reply | Quote | Up ^


#4 Re: Why does this regex require an additional "case-sensitive" option?

Posted by: Vany | Date: 2019-07-04 09:10 | IP: IP Logged

Hi, for whole word, you could try to search for "(?-i)\b[A-Z]{2,}\b", if you want to find even letters alone, it's simpler "(?-i)\b[A-Z]+\b"

--
Vany
(PSPad 5.5.1.812 x32, W10h/p x64 en/cs)

Options: Reply | Quote | Up ^


#5 Re: Why does this regex require an additional "case-sensitive" option?

Posted by: maki | Date: 2019-07-04 11:45 | IP: IP Logged

^(?-i)[A-Z]+$

You can use two more options, but one of the options unfortunately does not work, so you have to add ^ $

Edited 1 time(s). Last edit at 2019-07-04 11:49 by maki.

Options: Reply | Quote | Up ^


#6 Re: Why does this regex require an additional "case-sensitive" option?

Posted by: Vany | Date: 2019-08-13 17:41 | IP: IP Logged

but your version finds only upper case word on a separate line

--
Vany
(PSPad 5.5.1.812 x32, W10h/p x64 en/cs)

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR