I want to remove any leading and trailing non-alphabetic character in my string.
for eg. ":----- pt-br:-" , i want "pt-br"
Thanks
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.
will remove non-letters from the start and end of the string.
\Aand\Zanchor the regex at the start/end of the string (^/$would also match after/before a newline which is probably not what you want – but that might not matter in this case);[\d_\W]+matches one or more digits, the underscore or anything else that is not an alphanumeric character, leaving only letters.|is the alternation operator.