How to write this regular expression?

Source: Internet
Author: User
How to write this regular expression? 0 ^ 50411 ^ 1 ^ 10 ^ 5.0000 ^ 1900-01-01 ^ 0 ^ & nbsp; 10 & nbsp; ^ 58 ^ yuan/person ^ Youbang insurance $1 ^ 50411 ^ 1 ^ 20 ^ 5.0000 ^ 1900-01-01 ^ 0 ^ & nbsp; 20 & nbsp; ^ 59 ^ yuan/person ^ Ping An Insurance $2 ^ 5 How to write this regular expression?
0 ^ 50411 ^ 1 ^ 10 ^ 5.0000 ^ 1900-01-01 ^ 0 ^ 10 ^ 58 ^ RMB/person ^ Youbang insurance

$1 ^ 50411 ^ 1 ^ 20 ^ 5.0000 ^ 1900-01-01 ^ 0 ^ 20 ^ 59 ^ RMB/person ^ Ping An Insurance

$2 ^ 57777 ^ 1 ^ 60 ^ 50.0000 ^ 2012-12-19 ^ 633183 ^ 60 ^ 13 ^ RMB/person ^ AAAAAA

$3 ^ 57777 ^ 1 ^ 60 ^ 50.0000 ^ 2012-12-20 ^ 633183 ^ 60 ^ 13 ^ yuan/person ^ BBBBBB


This string of characters,

I want to use/\ $ \ d/to split a regular expression by $1, $2, and $3,

But this is not the case!

Then, use ^ to separate each array sub-element and obtain the names such as AIA and Ping An Insurance.

/\ ^/Cannot be written in this way, so strange!
------ Solution --------------------
$ S = <TXT
0 ^ 50411 ^ 1 ^ 10 ^ 5.0000 ^ 1900-01-01 ^ 0 ^ 10 ^ 58 ^ RMB/person ^ Youbang insurance

$1 ^ 50411 ^ 1 ^ 20 ^ 5.0000 ^ 1900-01-01 ^ 0 ^ 20 ^ 59 ^ RMB/person ^ Ping An Insurance

$2 ^ 57777 ^ 1 ^ 60 ^ 50.0000 ^ 2012-12-19 ^ 633183 ^ 60 ^ 13 ^ RMB/person ^ AAAAAA

$3 ^ 57777 ^ 1 ^ 60 ^ 50.0000 ^ 2012-12-20 ^ 633183 ^ 60 ^ 13 ^ yuan/person ^ BBBBBB
TXT;
Preg_match_all ('/[^] + $/M', $ s, $ r );
Print_r ($ r );
Array
(
[0] => Array
(
[0] => AIA

[1] => Ping An Insurance

[2] => AAAAAA

[3] => BBBBBB
)

)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.