やあみんなこれは単純なはずです、私はそれを見ていません、私はそれが主要な現金($)を見つけた後に動作する正規表現(PERL、Awk、SED / * nixの下で実行可能)を作成したいと思います等しい(=)で、二重引用符または一重引用符の最初のインスタンスと二重引用符または一重引用符の最後のインスタンスの間にあるものを処理します。
いくつか例を挙げましょう。
$this = 'operate on some text in here'; # operates between single quotes
$this = "operate on some text in here"; # operates between double quotes
$this = 'operate "on some text" in here'; # operates between single quotes
$this = 'operate \'on some text\' in here'; # operates between outer single quotes
私はいくつかの本当に悪い正規表現を試しました。しかし、それを正しく一致させることができませんでした。
興味のある人のために、これが私が挿入しているものです
printf '$request1 = "select * from whatever where this = that and active = 1 order by something asc";\n' |
grep '{regex}' * |
perl -pe 's/select/SELECT/g ; s/from/\n FROM/g ; s/where/\n WHERE/g ; s/and/\n AND/g ; s/order by/\n ORDER BY/g ; s/asc/ASC/g ; s/desc/DESC/g ;' | ## enter through file with all clauses
awk '{gsub(/\r/,"");printf "%s\n%d",$0,length($0)}' ## take first line convert to whitespace, use on following lines
みんなありがとう!