0

whats は、XX(a、s、d、f) のすべてのコンマを次のような長い文字列のパイプに置き換える最良の方法です

`exp` x(10) XX('s','44','f','dd','sddd') some other text here, text here , other text here

この部分だけカンマを置き換えたいXX('s','44','f','dd','sddd')【カッコ内はカンマのみ】

4

3 に答える 3

0

これは私がそれを修正した方法ですが、他のソリューションのためにまだ開いています

while (preg_match('/\(([^\)]*)\)/', $tableCols)){
                $tableCols = preg_replace('/\(([^\)]*)\)/e','"[[[".str_replace(\',\',\'|\',\'$1\')."]]]"', $tableCols);
            }
            $tableCols = str_replace('[[[', '(', $tableCols);
            $tableCols = str_replace(']]]', ')', $tableCols);
于 2013-07-11T12:08:19.867 に答える