Quote:
Originally Posted by kovidgoyal
why not just use the case sensitive checkbox to control if the regex is case sensitive or not.
And make the history matching case sensitive for the search and replace boxes.
|
Both of these are done.
Starson17 is talking about the standard search (the library search box), which is hardwired to be case insensitive. There is no easy way to pass an option along with a search, so a checkbox on advanced search won't work. I could use (?I) to invert the flag and also not do the source_text.lower() before applying the pattern, but that is a non-standard flag. It doesn't mean anything else, so it would work. It is unfortunate that python does not have the ability to invert case sensitivity in the middle of the regexp.
@starson17: python does not use the perl syntax '/i'. It uses (?iLmsux), where the letters specify the flag to be applied. The documentation is
Code:
(One or more letters from the set 'i', 'L', 'm', 's', 'u', 'x'.) The group matches the empty string; the letters set the corresponding flags: re.I (ignore case), re.L (locale dependent), re.M (multi-line), re.S (dot matches all), re.U (Unicode dependent), and re.X (verbose), for the entire regular expression. (The flags are described in Module Contents.) This is useful if you wish to include the flags as part of the regular expression, instead of passing a flag argument to the re.compile() function.