Regex matching left single quotation outside the double quotations

后端 未结 3 865
感情败类
感情败类 2021-01-29 12:55

Note :

left double quotation (\") = &ldquo

right double quotation (\") = &rdquo

left single quotation (\') = &lsquo

My current regex

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-29 13:33

    Use ASCII escape sequence to tell the regex which characters are you referring to.

    • \x93 - Refers to &ldquo
    • \x94 - Refers to &rdquo

    So the regex you need is: [\x93]*[^x94]

    Or if your you know what characters your string consists of, then: [A-Za-z0-9\x93]*[^x94], and so on. Add more characters as per your need.

提交回复
热议问题