isMatch function to find forward slashes in string

0
Hey all.   I’m not very knowledged in the world of regex, but it feels like something very simple, but I can’t work it out.   So let’s take a very simple string value as an example: ‘a/b’. I want to use the function isMatch to determine wether or not my string value contains a forward slash (which it does have). However, when I try to use functions like such: isMatch($Variable, '[^a-zA-Z0-9 ]') or isMatch($Variable, '\/'), it keeps returning false. It will only return true once the slash is the only value in the variable, which is not what I want. I want it to be true whenever there is a / in this variable/   Using onine tools in combination with this regex, it gives me the correct result, but not in Mendix. Could someone tell me what I’m doing wrong? Thanks!
asked
1 answers
3

I think you need to use contains, rather than isMatch. This will look for the single character anywhere in the string.

https://docs.mendix.com/refguide/string-function-calls/#8-contains

Update: Using isMatch

isMatch($Variable, '^.*?[/].*?$')



Hope this helps

answered