Hi,
i am using this code which is failing:
Runtime Error 5020...Please Login or Register to view this content.
Why?
How to find exact match within string above using regex?
Please help,
Jacek
Hi,
i am using this code which is failing:
Runtime Error 5020...Please Login or Register to view this content.
Why?
How to find exact match within string above using regex?
Please help,
Jacek
Why use RegEx for that? Just use Instr or Like.
Rory
hi Rory,
thank you.
Because i do not know how to use instr with it.
in textString i have 2 indirects formulas so i want to skip this.
How can i write a statement for this?
What i have is Table Name from dictionary.
Jacek
would be True if the text is found.Please Login or Register to view this content.
ok thank you.
but in this case it will work every time i have indirect formula there.
I want to catch when i have at least one table name without indirect.
What if i have:
textString = "=INDEX(T_DATACENTERSSOURCE[DATACENTER]),MATCH([@RegionName],INDIRECT(""T_DATACENTERSSOURCE[LOCATIONID]""),0))"
so one is indirect, one is not indirect and i have to have TRUE here and go further (not skip).
Best,
Jacek
That's not what your original code would have done. You can use Like and test for the table name without a quotation mark in front of it:
Please Login or Register to view this content.
thank you Rory!
what is this in your code?:
"["
Jacek
It's a character group, much like in RegEx.
very nice,
thank you!
this is so many exceptions here.
i need regex for this i think.
for example i have "T_ser" and looking within "T_serdetails".
in this formula:
textstring Like "*[!""]T_serdetails*" it will match but it shouldn't because i have different exact matched string...
Please help,
Jacek
Hi,
anyone?
Jacek
To answer your question on Post #1 : Why Rutime Error ?
Because :
the opening bracket is part of Regex's "Special Characters" used for grouping, so if you mean the actual opening bracket sign, you must escape it like this :Please Login or Register to view this content.
Please Login or Register to view this content.
1. I care dog
2. I am a loop maniac
3. Forum rules link : Click here
3.33. Don't forget to mark the thread as solved, this is important
hi,
thank you.
Ok this is still not working for me.
the goal is:
if i have at least one indirect within formula - skip the formula. (set function to false).
Rory provided solution how to check if indirect is there:
If we have table name with quotation mark - skip because this is indirect.
i tried use this code:
but pattern is not working. I can not delete the last quotation mark:Please Login or Register to view this content.
Screenshot_11.png
Please help with this,
Jacek
Why still not with InStr:
Please Login or Register to view this content.
Happy with my answer * Add Reputation.
If You are happy with solution, please use Thread tools and mark thread as SOLVED.
thank you KOKOSEK,
because if i will have table name like "T_DATACENTERS" it should not find it because it would be not exact match.
Instr will find evenr part of the string.
Jacek
You're missing a quote:
Please Login or Register to view this content.
StrComp Function
https://docs.microsoft.com/en-us/off...rcomp-function
Still confused, by your description, try this :
Please Login or Register to view this content.
thank you Rory! (sorry i can not add reputation to you i am adding it too often).
Working like a charm.
Ok and if i want to find out if there is exact table name but WITHOUT preceding quotation mark (so at least one no indirect table reference in formula), how the pattern will be look like?
i tried with:
but this is throwing error.Please Login or Register to view this content.
Please help,
Jacek
karedog, thank you!
Can you please explain this pattern?
\W - special characterPlease Login or Register to view this content.
what is "\" doing ?
Jacek
jindon, thanks!
how would you use this strcomp function together with instr?
It would be nice solution somehow?
Jacek
Use it instead of Instr like
Please Login or Register to view this content.
You are welcome, thanks for reps.
You want an exact match, so :
INDIRECT(""T_DATACENTERSSOURCE[DATACENTER]
should be matched
and
INDIRECT(""T_DATACENTERSSOURCExxx[DATACENTER]
should not be matched
To distinguish between them, in your case, there is direct "opening square bracket character [" immediately after the table name, and it is part of Regex's \W range.
karedog,
thank you.
jindon, thank you,
but this is not wotking
i tried with:
and with :Please Login or Register to view this content.
PatternToFind = """" & tablename
but still is not = 0...
Jacek
I didn't read the problem carefully,
Perhaps [ at the end of variable like
Then InStr Function ?Please Login or Register to view this content.
thanks, the solution was provided by Rory with regex function.
All other methos will work but i have a lot of cases so regex working the best.
Question is one:
How to:Please Login or Register to view this content.
i tried with:Ok and if i want to find out if there is exact table name but WITHOUT preceding quotation mark (so at least one no indirect table reference in formula), how the pattern will be look like?
but i failed.Please Login or Register to view this content.
Jacek
This is very difficult.
I tried also with this one link:
https://www.regextester.com/15
Screenshot_12.png
as you can see i didn't find a word ""badword" here so it is working fine.
but when i moved it to pattern:
Please Login or Register to view this content.
this is giving false witgin Regex function...Please Login or Register to view this content.
Please help,
Jacek
Remove the two / characters.
thank you Rory,
not working
it should give me a TRUE here...Please Login or Register to view this content.
Jacek
That / should be \
Still i am getting FALSE :/
Please Login or Register to view this content.
After spending a lot of hours on it i have!!!
thank you!Please Login or Register to view this content.
Jacek
Ok this is still not working
this is not looking for exact match!
this should be false because i have within lookup string T_DATACENTERSSOURCE , not T_DATACENTERS...Please Login or Register to view this content.
Please help,
Jacek
problem solved:
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks