Reputation: 189
I am trying to match a sentence that contains both English and Non English characters but does not contain pure numeric including decimals.
Example - Should match::
Renforcé-Bettwäschegar BLUMIRA123
Not match::
999.99
The following code matches everything that's not contained in the ASCII characters -
[^\u0000-\u0080]+
This is all I have at the moment. Any help will be much appreciated.
Thank you.
Upvotes: 0
Views: 5779
Reputation: 189
Thanks for the inputs. The below regex seem to work for me.
^([x00-\xFF]+[a-zA-Z][x00-\xFF]+)*
Upvotes: 0
Reputation: 6935
First of all I'll assume that you have split your text into sentences. Then try this:
!/(?:^| )[0-9]+(?:\.[0-9]+)?(?: |$)$/.test(sentence);
For example, this is the returned result for each of the below sentences:
Renforcé-Bettwäschegar BLUMIRA123 //true
999.99 //false
Another test //true
Hi this is a test 124 //false
Hi this is a test 124.23 //false
Upvotes: 2
Reputation: 834
See if this works:
.*([a-zA-Z].*[àáâäåÀÁÂÃçÇêéëèÊËÉÈïíîìÍÌÎÏñÑöòõóÓÔÕÖÒšŠúüûùÙÚÜÛÿŸýÝžŽ]|[àáâäåÀÁÂÃçÇêéëèÊËÉÈïíîìÍÌÎÏñÑöòõóÓÔÕÖÒšŠúüûùÙÚÜÛÿŸýÝžŽ].*[a-zA-Z]).*
Upvotes: 2
Reputation: 1027
This should do the trick
!/^[0-9.]+$/.test(s)
Please note that will match only numbers and decimals, so you need to negate it (the !)
Upvotes: 1