What does the regular expression (^ | &) on the page mean?

Source: Internet
Author: User
What does the regular expression (^ | &) on the page mean? I cannot understand the common paging functions on the Internet:
What does this regular expression mean?
$ Url_query = ereg_replace ("(^ | &) page = $ page", "", $ url_query );/

(^ | &)
This regular expression means:

^ Indicates the starting position; or [^...] indicates not;
| Yes or;
------
(^ | &) Is ^ OR & or what? In addition, the ^ symbol cannot appear in the URL. why should I replace it with ^?
Add an escape character even if you want to replace ^;


Reply to discussion (solution)

^ Indicates that the string starts.
& Represents Characters &
^ | & Indicates the start or end of a string

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

Null or &??, Followed by page ??

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

Use less regular expressions

Match with an empty note or an & prefix

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.