Regex (tests) not working as expected ?
Hi
I tested the expression (eg in regex101) and it works... ---> (?i)ber(?-i)
This should return as true in any String the existence of "Ber", "ber", "bEr", etc for instance Bernard, Norbert, Robert, eetc
I am entering this in a view.. and get 0 Records
(Note: I am already replacing the value I am reading from a field with the value "ber" because
let xName := "ber";
let myREG := "(?i)" + xName + "(?-i)";
(select Writer)[testx('First Name', text(myREG))]
if I have though (select Writer)[testx('First Name', "ber")]
then it finds the records where "ber" is in the middle eg Robert, etc.... but NOT Bernard... (that woudl be "Ber"
So...
does Ninox not support the case insensitive?
thanks!
9 replies
-
Got ! after killing my head I found a way.... but stil my question is why doesnt the expression with (?i) and (?-i) work?
here is what works (for anyone who might need this later:
let xName := 'First Name contains';
(select Writer)[testx('First Name', text(xName), "i")]i.e. use "i"as flag
-
You answered your own question. From the manual...
testx(string, regular_expression, flags)
You were trying to combine the pattern with the flag and I'm not so sure your pattern would work.
-
You answered your own question. From the manual...
testx(string, regular_expression, flags)
You were trying to combine the pattern with the flag and I'm not so sure your pattern would work.
-
Well, I always wondered how people managed to post the same thing twice
-
-
Here are a couple of ways that produce the same result in a View layout element. First, uses the
testx()
function and 'Search String' is a text field...let regex := "\w*" + 'Search String' + "\w*";
select Names where testx(Name, regex, "i")Second, uses the
contains()
function...let srchString := upper('Search String');
select Names where contains(upper(Name), srchString) -
Thanks Sean!
the solution with the flag is indeed what I found in the manual - but is not a solution for some of the cases eg : in some cases I want only a part of the string to be case insensitive... not the whole string... and so he flag is not appropriate... that is the Regex has (i) and (-i)...
that is why I went back to my origianl question: is this not supported in Ninox? (yes, there is a workaround with a lot of code to test all the diferent parts and then join the conclusions with 'case' of 'if then else'...
thanks
luis
-
You're welcome Luis. I'm fairly confident Ninox does not support the ability to turn modes on/off for only part of the regular expression. Where the manual briefly mentions the regex functions, it refers you to a Javascript link. My understanding is Javascript's regex engine is one of the least robust and Ninox's is even less so.
I'm still not following your reasons for not using
upper()
or using the "i" flag for the entire string based on your original example. Can you post an example where those wouldn't work? -
Hi Sean,
for the "Book Library" I can get away with the generic "i" flag... but I have another case where certain Fields require an identification eg like a Password... that is case sensitive.
Content aside
- 4 yrs agoLast active
- 9Replies
- 1073Views