简体   繁体   中英

How to remove single quotes from expression?

I have an hindi expression 'बैंक धोखाधड़ी के कानूनी पहलुओं' from which i am trying to escape the single quotes before entering into database but mysql_real_escape_string and addslashes is not working, what can be done in this case?

When i am replacing the ' in the original expression with ' and performing the operation, addslashes are working. are they different in any way?

Here is the regular expression I have tested to be working on your scenario:-

(?<mystring>[^\u2018]+[^\u0000-\u007F\u2018$]+)

You will get the result as named capture group 'mystring' as in the regular expression.

Your string is Unicode. The quotes are unicode character "\‘" .You can use the above regular expression to match the required string and then use that string (your string between unicode quotes) to do the insert.

HTH!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM