455
Views
13
Comments
String ending with , or .
Question

How to identify given string is ending with anyspecial character or not?

As of now I am using regex search. But now sure how to check for only end of the string.


Basically I need to remove these special char from the end of the string

2021-03-05 13-56-11
Ricardo Pereira
 
MVP

Hi,


You can use the Index function like this:


If index starting from end is 0 that means that is found.


Hope this can help.


Best regards,

Ricardo M Pereira

UserImage.jpg
Ankita Kulkarni

Ricardo Pereira wrote:

Hi,


You can use the Index function like this:


If index starting from end is 0 that means that is found.


Hope this can help.


Best regards,

Ricardo M Pereira

 

 Hi Ricardo,

I am thinking of using, string_split(Text, index(text,",", searchfromend:true).Will this split all the variable in to list seperating by , or only 2.


2018-12-01 17-54-01
Sourav Pasari

Ankita Kulkarni wrote:

How to identify given string is ending with anyspecial character or not?

As of now I am using regex search. But now sure how to check for only end of the string.

 

 Is it any special chars OR only . ,

UserImage.jpg
Ankita Kulkarni

Sourav Pasari wrote:

Ankita Kulkarni wrote:

How to identify given string is ending with anyspecial character or not?

As of now I am using regex search. But now sure how to check for only end of the string.

 

 Is it any special chars OR only . ,

 only . ,

 

2020-06-04 15-38-19
Samiksha Manekar

Hi Ankita,

Try this Regex Expression

[a-zA-Z0-9](.*[a-zA-Z0-9])?$

Let me know if it works for you.

Regards,

Samiksha

2020-06-04 15-38-19
Samiksha Manekar

Samiksha Manekar wrote:

Hi Ankita,

Try this Regex Expression

[a-zA-Z0-9](.*[a-zA-Z0-9])?$

Let me know if it works for you.

Regards,

Samiksha

 You can validate you string on https://regexr.com/

ex

 

2024-02-16 07-43-18
Amit Verma

Hi Ankita,

can you please confirm one thing only check ending with any special character  or any thing where in the string.

Please refer below character if you want to restrict the special characters

https://www.outsystems.com/forums/discussion/58583/how-to-check-special-characters-in-a-string/

Hope this will help you :)

- AV

Thanks

2024-02-16 07-43-18
Amit Verma

Hi Ankita,

Please refer this post if you want to remove special characters

https://www.outsystems.com/forums/discussion/55651/remove-special-characters/

Please let me know if you have any query

- AV

Thanks


2021-03-18 21-03-15
Benjith Sam
 
MVP

Hi Ankita,

You can use the Regex_Replace server action available in the Text Extension for the mentioned use case.

See this sample app - RegexDemo (RWA)

The implementation also works in case of string ending with multiple dot and comma symbol

Used Regex Pattern:

"[,.]+$"

Hope this helps you!


Regards,

Benjith Sam

2018-10-29 08-31-03
João Marques
 
MVP

Hi Ankita,


For future reference, there is a component called Regex How To that allows you to test regular expressions, see how to implement Regex both on Server side and Client side and see the most common patterns.

Using the same pattern as described by Benjith:


"[,.]+$"

 

you can see how it works both on Server side and Client side.


If you are developing a Mobile or Reactive application, you probably want to use a client action so it can work offline and it is more performant as it avoids going to the server.


Hope it helps.


Cheers,

João

2020-04-17 08-41-30
Tim Timperman

I understand coming up with great solutions, but why not just keep it simple? That typically works best.

Var2 = Substr(Var1,Length(Var1)-1,1)

Var1 = If(Var2 = "." or Var2 = ",", Substr(Var1, 0, Length(Var1)-1), Var1)

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