User Profile

Collapse

Profile Sidebar

Collapse
pascalito
pascalito
Last Activity: Dec 10 '09, 09:34 PM
Joined: Oct 6 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • pascalito
    replied to Preg_split question
    in PHP
    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 ......
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    I do not control the delimitator, otherwise, I never asked and I simplified input string...
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    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,
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    there is a mistake in the preg_split solution, pattern is "/('.+?'|[^\|]+)\||$/"
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    quicker and easier ??
    ok, write me the function who parse input data......
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    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
    )
    « 'hello||world\' abc\'def' » is splitted in 2 parts... not good

    I have found...
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    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...
    See more | Go to post

    Leave a comment:


  • pascalito
    replied to Preg_split question
    in PHP
    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);
    But the pattern is wrong......
    See more | Go to post
    Last edited by Dormilich; Oct 6 '09, 02:33 PM. Reason: Please use [code] tags when posting code

    Leave a comment:


  • pascalito
    started a topic Preg_split question
    in PHP

    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
    See more | Go to post
    Last edited by pascalito; Oct 6 '09, 02:11 PM. Reason: adding preg_split function
No activity results to display
Show More
Working...