Good Day!, I have trouble handling emojis in Regex for input fields because I want my input field not to accept emojis but some are still accepted, here's the regex I used https://www.regextester.com/106421 

Hi Philip,

Why don't you write your Regex to reflect what you accept, instead of what you don't? Emojis keep growing, seems like every new release of the Unicode standard comes with at least a few new ones.

Jorge Martins wrote:

Hi Philip,

Why don't you write your Regex to reflect what you accept, instead of what you don't? Emojis keep growing, seems like every new release of the Unicode standard comes with at least a few new ones.


I already tried specifying the only character to be accepted on the regex (eg. Alphanumeric characters) however in an unknown reason, some emojis like the heart emoji still passes through. Have you experienced this kind of issue? This is for a mobile app. Thank you.


You can check the sample .oml file attached

Hi,

In this link from the stack overflow they seem to have the solution, the regex that they found is: 

^[^\u{203C}\u{2049}\u{20E3}\u{2122}\u{2139}\u{2194}-\u{2199}\u{21A9}-\u{21AA}\u{231A}-\u{231B}\u{23E9}-\u{23EC}\u{23F0}\u{23F3}\u{24C2}\u{25AA}-\u{25AB}\u{25B6}\u{25C0}\u{25FB}-\u{25FE}\u{2600}-\u{2601}\u{260E}\u{2611}\u{2614}-\u{2615}\u{261D}\u{263A}\u{2648}-\u{2653}\u{2660}\u{2663}\u{2665}-\u{2666}\u{2668}\u{267B}\u{267F}\u{2693}\u{26A0}-\u{26A1}\u{26AA}-\u{26AB}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26CE}\u{26D4}\u{26EA}\u{26F2}-\u{26F3}\u{26F5}\u{26FA}\u{26FD}\u{2702}\u{2705}\u{2708}-\u{270C}\u{270F}\u{2712}\u{2714}\u{2716}\u{2728}\u{2733}-\u{2734}\u{2744}\u{2747}\u{274C}\u{274E}\u{2753}-\u{2755}\u{2757}\u{2764}\u{2795}-\u{2797}\u{27A1}\u{27B0}\u{2934}-\u{2935}\u{2B05}-\u{2B07}\u{2B1B}-\u{2B1C}\u{2B50}\u{2B55}\u{3030}\u{303D}\u{3297}\u{3299}\u{1F004}\u{1F0CF}\u{1F170}-\u{1F171}\u{1F17E}-\u{1F17F}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F1E7}-\u{1F1EC}\u{1F1EE}-\u{1F1F0}\u{1F1F3}\u{1F1F5}\u{1F1F7}-\u{1F1FA}\u{1F201}-\u{1F202}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F23A}\u{1F250}-\u{1F251}\u{1F300}-\u{1F320}\u{1F330}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F380}-\u{1F393}\u{1F3A0}-\u{1F3C4}\u{1F3C6}-\u{1F3CA}\u{1F3E0}-\u{1F3F0}\u{1F400}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4F7}\u{1F4F9}-\u{1F4FC}\u{1F500}-\u{1F507}\u{1F509}-\u{1F53D}\u{1F550}-\u{1F567}\u{1F5FB}-\u{1F640}\u{1F645}-\u{1F64F}\u{1F680}-\u{1F68A}]*$

Hope it helps :)

Hi Philip,


The following regex matches all non-ascii characters including spaces until reaching an ascii character.

[^\x00-\x7F]+\ *(?:[^\x00-\x7F]| )*

Hope it helps.

Kind regards,

Glenn

Thank you for the help guys, however some of the emojis are still being accepted. Maybe this is some of the limitations of OutSystems? 

Hi Philip,

this doesn’t seem to be an OutSystems limitation per se, the Regex functionality is supported directly by .NET framework functionality.

I believe it’s a matter of refining your regex further, but that’s not something I do too often, so can’t help you much further. I’d say you can get help for this in all the other forums not specific to OutSystems though, like stackoverflow, etc...

Jorge Martins wrote:

Hi Philip,

this doesn’t seem to be an OutSystems limitation per se, the Regex functionality is supported directly by .NET framework functionality.

I believe it’s a matter of refining your regex further, but that’s not something I do too often, so can’t help you much further. I’d say you can get help for this in all the other forums not specific to OutSystems though, like stackoverflow, etc...


Oooh I see, Thank you!

you can use the regex_search action from text API.

Please check the Link,

https://www.outsystems.com/forums/discussion/34651/using-regex-search/

I hope this will help you to update the code.

Please check and let me know your feedback.

Thank you,

Sudip

Philip Paolo De Castro wrote:

Thank you for the help guys, however some of the emojis are still being accepted. Maybe this is some of the limitations of OutSystems? 

Philip,

Could you tell me which emoji's are still being accepted?
I'm working on a forge component ( RegexLib ) and an emoji filter seems like a useful regex to add.

Kind regards,

Glenn



glenn michiels wrote:

Philip Paolo De Castro wrote:

Thank you for the help guys, however some of the emojis are still being accepted. Maybe this is some of the limitations of OutSystems? 

Philip,

Could you tell me which emoji's are still being accepted?
I'm working on a forge component ( RegexLib ) and an emoji filter seems like a useful regex to add.

Kind regards,

Glenn


Good day Glenn,

Here are some of the emoji's accepted using the regex you provided please see the attached image thank you hope it helps.