Quantcast

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
|  
Report Content as Inappropriate

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
|  
Report Content as Inappropriate

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

Hugo <Nabble>
Administrator
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.
Official Nabble Administrator - we never ask for passwords.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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
|  
Report Content as Inappropriate

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

Hugo <Nabble>
Administrator
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.
Official Nabble Administrator - we never ask for passwords.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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
|  
Report Content as Inappropriate

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

Hugo <Nabble>
Administrator
DavidJCobb wrote
Oh, it's Java regexes, right?
Yes, you can use java.util.regex as your reference.
Official Nabble Administrator - we never ask for passwords.
Loading...