Search Results

Search found 1 results on 1 pages for 'kovo'.

Page 1/1 | 1 

  • Regex - Modifying strings except in specified enclosures - PHP

    - by Kovo
    I have found similar answers to my current needs on SO, however I am still trying to grasp modifying strings based on a rule, except in certain enclosures within those strings. Example of what Im trying to accomplish now: preg_replace("/\s*,\s*/", ",", $text) I found the above in many places. It will remove spaces before and after all commas in a string. That works great. However, if I want to exclude modifying commas found within " ", I am not sure how that rule has to be modified. Any help? Thanks! EDIT: I want to clarify my question: I would like all whitespace before and after the commas in the following sentence removed, except commas found in double or single quotes: a, b , c "d, e f g , " , h i j ,k lm,nop Expected result: a,b,c "d, e f g , ",h i j,k lm,nop

    Read the article

1