Why REGEX_COUNT with semicolon doesn't work? - regex

I'm trying to count the number of semicolon separated values in OBIEE.
I'm using the following formula: EVALUATE('REGEXP_COUNT(%1, '';'')', "Bibliographic Details"."Title") It returns an error:
When I try to use the same formula but change the '';'' with say ''a'' everything works as expected.
I don't recall semicolon being a saved character in REGEX so it's weird to me.

What I did eventually that gave me the required result:
EVALUATE('REGEXP_COUNT(%1, ''\;'')', "Bibliographic Details"."Title")
For some reason the "\" before the ";" fixed the problem.

Related

USING DAX: How can I get output that are not blank from COMBINEVALUES()?

I have several nested IF statements in a COMBINEVALUES(), everything works but I am trying to remove ",,,VALUE,VALUE" the occurrences of blank comma separations so it displays as "VALUE,VALUE".
Any suggestions?
COMBINEVALUES(",",IF(,"","VALUE"),IF(,"VALUE",""))
is the general example of the code, but is there a way in DAX/M code to do this?

REGEXMATCH and MATCH don't work when a cell contains a number

I am trying to use formulas to find a row in my google spreadsheet document, however I have got a weird problem.
I am not able to find values when a cell contains a number (without any other characters).
Consider the following case
I have got two values
A1 - 32323232323
A2 - 323-23232-323
When I use the following formula
=FILTER(A:E,REGEXMATCH(B:B,"323-23232-323"))
It works fine, it successfully finds A2 value, however when I try to use the following formula
=FILTER(A:E,REGEXMATCH(B:B,"32323232323"))
It doesn't match any row, and I also tried the following formula
ADDRESS(MATCH("32323232323",B:B,0),1)
It doesn't work either, it only works when I remove quotes like that
ADDRESS(MATCH(32323232323,B:B,0),1)
But this doesn't work with REGEXMATCH.
Is there any way I can match numbers using a regex expression (exact number, without wildcards) ?
Thanks
=FILTER(A:A,REGEXMATCH(REGEXREPLACE(TO_TEXT(A:A),"-",""), "32323232323"))
to get both 323-23232-323 and 32323232323.
=FILTER(A:E,REGEXMATCH(TO_TEXT(B:B),"32323232323"))
to get number 32323232323.
Notes:
Converting to_text is a key here.
Change columns to yours.

Check if cell contains numbers in Google Spreadsheet using RegExMatch

I want to check if specific cell contain only numbers.
I know I should use RegExMatch but I get an error.
This is what I wrote : =if(RegExMatch(H2,[0-9]),"a","b")
I want it to say : write 'a' if H2 contains only numbers, 'b' otherwise.
Thank you
Try this:
=IF(ISNUMBER(H2,"A","B"))
or
=if(isna(REGEXEXTRACT(text(H2,"#"),"\d+")),"b","a")
One reason your match isn't working also - is that it in interpreting your numbers as text. the is number function is a bit more consistent, but if you really need to use regex, then you can see in the second formula where im making sure the that source text is matching against a string.
Your formula is right, simple you forget the double quotes at regexmatch function's regular_expression .
This is the right formula: =if(RegExMatch(B20,"[0-9]"),"a","b")
=REGEXREPLACE(“text”,”regex”,”replacement”)
It spits out the entire content but with the regular expression matched content replaced. =REGEXREPLACE(A2,[0-9],"a")
=REGEXREPLACE(A2,![0-9],"b")//not sure about not sign.
will fill a cell with the same text as A2, but with the 0-9 becoming an a!

What's wrong with this Excel code involving IFs?

=IF(B33=I33,K33,IF(B33=I34,K34,IF(B33=I35,K35)))*1000+(D33)/(C33)
The code works fine as this:
=IF(B33=I33,K33,IF(B33=I34,K34,IF(B33=I35,K35)))*1000+(D33)
But I want to afterwards divide the figure by the value in C33. I have tried multiple ways of including the / C33 but they all add up to the wrong value or give errors.
Your brackets are in the wrong place:
=(IF(B33=I33,K33,IF(B33=I34,K34,IF(B33=I35,K35)))*1000+D33)/C33
^ ^
Key ones highlighted. Note that you will get errors if the value in C33 is zero...

using ^ (caret) inside the states in lex/flex

I'll put up my lex code first(lex body only).
%%
ps {BEGIN STATE1;}
. ;
<STATE1>^[0-9] print("number after ps".)
with this code I'm trying to match a number right after the letters "ps". Thats why I used ^ character.
But the code doesn't match any correct strings such as ps3, ps4fd,ps554 etc.
Then I removed the ^ and tried but then it worked but also matches strings like pserd7, psfh45,psfhdjh4er etc.
I know that I can solve the problem without using states (ps[0-9].*). But I have to do this with states. How can I fix this? thanks....
with this code I'm trying to match a number right after the letters "ps". Thats why I used ^ character
But ^ doesn't mean that. It means 'beginning of line'.
I know that I can solve the problem without using states (ps[0-9].*). But I have to do this with states.
Why? Very strange requirement.
You need to add more rules to cover the other possibilities. For example:
<STATE1>. { BEGIN INITIAL; }
But this depends on what else if anything is legal after 'ps'.