What is the meaning of this sentence (^|&) in the pagination, I can't understand

Source: Internet
Author: User
Common paging functions on the Web:
What is the meaning of this sentence?
$url _query=ereg_replace ("(^|&) page= $page", "", $url _query);

(^|&)
This is the meaning of the sentence:

^ represents the starting position, or in the [^..] Non-representative;
The meaning of being or;
------
(^|&) is ^ or & or what? In addition, it is not possible to appear in the URL ^ this symbol ah; why replace ^
You should add an escape character even if you want to replace ^.


Reply to discussion (solution)

^ denotes string start
& denotes characters &
^|& means starting from a string or starting with a character &

Your rule string is expected to match to:
Page=1
id=2& page=1

Empty or &??, followed by page???

Http://www.example.com/?page=1
Http://www.example.com/?action=list&page=1

Use fewer regular expressions

An empty note or a match at the beginning of A &

  • 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.