How does one make a regex case-insensitive?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How does one make a regex case-insensitive?

DavidJCobb
In JavaScript, it's /pattern/i, but seeing as regexes in NAML don't use delimiters like /, I'm not really sure how it'd be done.
Reply | Threaded
Open this post in threaded view
|

Re: How does one make a regex case-insensitive?

Hugo <Nabble>
This is a good request and we will implement this now (please give us one or two days to have this change released to all servers). Basically, we will add a new parameter called case_insensitive to all regex commands (e.g., regex_replace_all, etc.)  just like this:
<n.regex_replace_all. pattern="abc" replacement="def" case_insensitive="true">
     test test test test 
</n.regex_replace_all.>
I will let you know when this is released. Thanks for the feedback.
Reply | Threaded
Open this post in threaded view
|

Re: How does one make a regex case-insensitive?

DavidJCobb
Hugo <Nabble> wrote
I will let you know when this is released. Thanks for the feedback.
No prob, and thanks for the update. :)
Reply | Threaded
Open this post in threaded view
|

Re: How does one make a regex case-insensitive?

Hugo <Nabble>
In reply to this post by DavidJCobb
We just realized you can start the regex with "(?i)" to turn on case insensitive matching. Example:
(?i)a|b|c
So there is no need for the extra parameter mentioned in my other reply.
Reply | Threaded
Open this post in threaded view
|

Re: How does one make a regex case-insensitive?

DavidJCobb
(?i)?

Oh, it's Java regexes, right? Thanks for the tip!
Reply | Threaded
Open this post in threaded view
|

Re: How does one make a regex case-insensitive?

Hugo <Nabble>
DavidJCobb wrote
Oh, it's Java regexes, right?
Yes, you can use java.util.regex as your reference.