105
Views
6
Comments
[Regex] Does not work
Question
regex
Service icon
Forge asset by Nelson Marques
Application Type
Service
Service Studio Version
11.54.28 (Build 62865)

Does not work.

Example:

pattern: "/^[a-z]*$/i" (check non latin letters)

Text: "נוצרOPGN"

2023-01-05 17-39-49
Leonardo Pires
Champion

Hi Bar Code Guru,

Try check this regex....


https://regex101.com/r/zI2Xoc/1


King Regards

2021-06-03 11-03-21
Anubhav Rai

Hi @Bad Code Guru ,

As per your regex /^[a-z]*$/i   it will match a string if it contains only lowercase letters (or no letters at all), and it will be case-insensitive. If the string contains any uppercase letters or other characters (digits, symbols, etc.), the regex won't match (All these conditions are for the English language).

If you are looking for Latin Regular expressions then, there will be some keywords which is different from Normal regular expressions, and I think this component is not supporting Latin regular expressions.


Regards,

2024-07-18 04-13-51
Muneera Shaik

Hi @Bad Code Guru ,

Though I don't have idea about the FORGE Component which you have mentioned, but I could suggest you an alternate to work around with Regular Expressions with the JS Node.

Please take a look at the oml file attached below.

If you find my answer helpful, please mark as Solution.


Thanks,

Muneera Shaik

RegexSample.oml
2025-02-14 09-30-49
Nelson Marques

Hi @Bad Code Guru 


I would first remind you that this component is just a wrapper on the Regex.Matches C# Method. Having said this, as far as I can tell, the pattern you provided does indeed not return any matches for the example text you provided, because it shouldn't, so I conclude the component is working correctly.


Just to double-check, I did a quick test prepending part of your example text to the pattern and got a match, so the component supports the characters that you are using.


What exactly are you trying to achieve? Leonardo has already given you an alternative, but without knowing your use case, we can only guess what the correct regex should be.


You can also use some online tools that can explain the regex you are using, so that you can have a better understanding of what it is matching.


Regards

2023-07-23 14-37-01
Bad Code Guru

Thank you for your replay.

The task is to identify if there are at least one non-latin char in the input string.

Quick test in console shows it should work:


  • On a client side I use Javascript to check, and it works with the given pattern.
  • When I use the extension method at server side, it does not work with the pattern.


As a workaround I came up with OS regex replace action, where I replace any latin char in a string with String.Empty, and check the length of a result. If it is non zero, then there are non-latin character.

Thank you.

2025-02-14 09-30-49
Nelson Marques

Hi @Bad Code Guru 


Your last example tests just the string "OPGN". This test also works when using the component:

Using your original test string "נוצרOPGN" it will not match with your current regex as was already explained above.


If you want to capture anything that is not the "a-z" chars in the input string, then you can try the following regex: [^a-z]+

(Remember to set IgnoreCase = True, so the regex is case insensitive)

This will return the invalid chars when they exist:

And will return nothing if all chars are valid:



Regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.