Regex matching left single quotation outside the double quotations

后端 未结 3 820
感情败类
感情败类 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.

    0 讨论(0)
  • 2021-01-29 13:34

    this is the right regex that I am looking at :

    (?<!.*&ldquo;)&lsquo;(?!.*&rdquo;)
    

    Thanks!

    0 讨论(0)
  • 2021-01-29 13:42

    If I understood ur question..This may be what you want

    (?<!&ldquo.*?)&lsquo(?!&rdquo)
    
    0 讨论(0)
提交回复
热议问题