Ask another regular expression about the ending $

Source: Internet
Author: User
Ask another regular expression about the ending $
Preg_match_all ("/ar $/I", "batr bar car ar asdf", $ out); print_r ($ out );


This code contains $. isn't it the word ending with r? btar bar car ar should all be output. Why is there nothing.
Isn't that true?


Reply to discussion (solution)

Is to check whether the string has ended with ar.

Preg_match_all ("/ar \ B/I", "batr bar car ar asdf", $ out );

$ Is the end of a line...

$
End of the assertion target (or end of the downlink in multiline mode, that is, before a line break)

The second floor at the end of the word you want to give you the answer. the asserted at the end of the word is \ B.

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.