PHP preg_match_all: Extract comma separated list

前端 未结 1 1817
广开言路
广开言路 2021-01-28 09:15

I have, for example, the following string:

{WIDGET_TEST(\'abc\',\'456\')}

I\'d like to be able to use preg_match_all to return an array of the

相关标签:
1条回答
  • 2021-01-28 09:52

    I think if you try the following regex it should work for what you need:

    preg_match_all('/([a-zA-Z0-9_]+)/', '{WIDGET_TEST(\'variable1\', \'b\')}', $classname);
    

    It should return, from the input string, the strings that are constructed from ‘abcdEDFGHJ123’. To put it bluntly, it will return a new result when the string breaks from this makup.

    0 讨论(0)
提交回复
热议问题