I have a problem to extract only ‘a-zA-Z0-9- _’ from string.
Example;
If i input “A cat นกห 004-1 กกกกก”
it show me only ‘a-cat-004-1’
or
if i input “aa مقتطف 4-5 aaa” –> ‘aa-5-4-aaa’
any idea?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do the following:
[^a-zA-Z0-9_ -]by nothing. This eliminates any characters you don’t want.' +'(one or more spaces) by-At least that’s what I can guess what you want there. Your examples don’t match your problem description. The part about the spaces and lower-case was inferred from your examples since you didn’t mention it.
In PowerShell this might look like the following:
Adapt accordingly for PHP or Javascript. Both support regular expressions and string functions.