I never said any more than I could change the string but it seems logical to me.
If I could change the string, do you really think I asked any questions ......
User Profile
Collapse
-
I do not control the delimitator, otherwise, I never asked and I simplified input string...Leave a comment:
-
TheServant, you do not answer the question...
I know how to use the explode function, everyone knows how to use this function...
you say it is quicker and easier to convert input data, ok, I ask you to write the function that converts input data from "foo|bar|'hello |world\'abc\'de f'|bye" to "foo||bar||'hel lo|world\'abc\' def'||bye"
Regards,Leave a comment:
-
there is a mistake in the preg_split solution, pattern is "/('.+?'|[^\|]+)\||$/"Leave a comment:
-
quicker and easier ??
ok, write me the function who parse input data......Leave a comment:
-
Your example is not good :
If my string is "foo|bar|'hello ||world\'abc\'d ef'|bye" (note the ||)
your example code return :
Code:Array ( [0] => foo [1] => bar [2] => 'hello [3] => world\'abc\'def' [4] => bye )
I have found...Leave a comment:
-
No, watch my example :
"foo|bar|'hello |world\'abc\'de f'|bye"
With explode function, i obtains :
foo
bar
'hello
world\'abc\'def '
|bye
I would like :
foo
bar
hello|world'abc 'def
bye
It's not the same...
Thank you...Leave a comment:
-
i use preg_split function like this :
Code:$val = "foo|bar|'hello|world\'abc\'def'|bye"; $val = preg_split('/(?:\s\|\s)(?![\w\s]*\')/', $val, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); print_r($val);
Leave a comment:
-
Preg_split question
Hi,
i have a problem with a regular expression.
i want to split a string on character pipe | with preg_split php function.
The string is :
"foo|bar|'hello |world\'abc\'de f'|bye"
Result of split must be in an array :
foo
bar
hello|world'abc 'def
bye
Anyone have an idea ?
Thank you !!
bye
No activity results to display
Show More
Leave a comment: