B4J Question Regex help (I love, hate and don't know it!)

LucaMs

Expert
Licensed User
Longtime User
This line:
B4X:
ExtraChars = Regex.Replace ("([^a-z])", ExtraChars, "")
should "remove" all lowercase letters from ExtraChars (replace with empty strings).

If ExtraChars is: "5?" it removes all.

---

Actually, the complete thing I would need is a regex expression to accept any letters and special characters passed by the user (ExtraChars parameter).
 

Star-Dust

Expert
Licensed User
Longtime User
.replace( "/[a-z]/g","")

 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
B4X:
ExtraChars = "ab12"
ExtraChars = Regex.Replace("([^a-z])", ExtraChars, "")
Result: ab
then it does not replace letters, keeps them :oops:
With the symbol ^ invert, so it substitutes for those that are not lowercase
 
Upvote 0
Top