简体   繁体   English

SQL REGEX WHERE COLUMN ='VALUES'解析器

[英]SQL REGEX WHERE COLUMN = 'VALUES' PARSER

I'm making a regex to match all value inside the column = 'value' mainly on the sql's where clause the value can be from alphanumeric to special char, space, ', = etc. Here's what I have so far. 我正在做一个正则表达式来匹配column = 'value'内的所有值,主要是在sql的where子句中,值可以是字母数字到特殊的char,空格,',=等。这就是我到目前为止的内容。

SQL: SQL:

select count(*) from t_cusUser where AccountID = ' !@#$%^&()+{}?|.'_' and column = '3' and column = ' ~!@#$%^&-_+{}|'./?Polite' 从t_cusUser中选择count(*),其中AccountID =' !@#$%^&()+{}?|.'_' and column = '3' and column = ' 〜!@#$%^&-__ + {} |'./?Polite'

REGEX: 正则表达式:

(?<=\\=)\\s?N?\\'([\\w\\'-\\s\\&{}#\\$\\^()\\@\\~\\%\\|/.`*\\~!+\\?"]+)\\' (?<= \\ =)\\ s?N?\\'([\\ w \\'-s \\&{}#\\ $ \\ ^()\\ @ \\〜\\%\\ | /.`* \\〜!+ \\?“] +)\\'

RESULT: 结果:

  1. '`!@#$%^&()+{}?|.'_' '`!@#$%^&()+ {}?| .'_'
  2. '3' '3'
  3. '`~!@#$%^&-_+{}|'./?Polite' '`~!@#$%^&-__+{}|'./?礼貌'

It works fine, but if I put a = character then the problem occurs. 它工作正常,但是如果我输入=字符,则会出现问题。

REGEX: (Added = char) 正则表达式:(添加=字符)

(?<=\\=)\\s?N?\\'([\\w\\'-\\s\\&{}#\\$\\^()\\@\\~\\%\\|/.`*\\~!+\\?" = ]+)\\' (?<= \\ =)\\ s?N?\\'([\\ w \\'-s \\&{}#\\ $ \\ ^()\\ @ \\〜\\%\\ | /.`* \\〜!+ \\?“ = ] +)\\'

RESULT: 结果:

  1. ' !@#$%^&*()+{}?|.'_' and column = '3' and column = ' ~!@#$%^&*-_+{}|'./?Polite' ' !@#$%^&*()+{}?|.'_' and column = '3' and column = ' ='~!@#$%^&*-_+{}|'./?Polite '

Try this. 尝试这个。

((?<=\\=)\\s*N?[a-zA-Z0-9.!?#$=@&%'^+|_~-/()*{}`]+)' ((?<= \\ =)\\ s * N?[a-zA-Z0-9。!?#$ = @&%'^ + | _〜-/()* {}`] +)'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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