| |

VerySource

 Forgot password?
 Register
Search
View: 822|Reply: 7

A regular question !! Urgent

[Copy link]

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-19 09:40:01
| Show all posts |Read mode
How to get Shandong and Qingdao in Qingdao, Shandong Province
Expert advice
Reply

Use magic Report

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-26 11:18:01
| Show all posts
How to get the content before the provinces in city x and y city / the content before the city and the province only! In fact, it is to intercept the province X and city Y
Expert advice
Regular or other methods
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-1-26 12:18:01
| Show all posts
/^(.)+(?= 省) (. +) (? = 市) $ /. Exec ("X 省 y 市");
alert (RegExp. $ 1); / * x * /
alert (RegExp. $ 2); / * y * /
Reply

Use magic Report

0

Threads

7

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-26 12:45:01
| Show all posts
Regular expression that matches Chinese characters: [\u4e00-\u9fa5]
Commentary: Matching Chinese is really a headache, and it's easy with this expression

Match double-byte characters (including Chinese characters): [^\x00-\xff]
Commentary: Can be used to calculate the length of a string (a double-byte character length meter 2, ASCII character meter 1)

Regular expression matching blank lines:\n\s *\r
Commentary: Can be used to delete blank lines

Regular expression matching HTML tags: <(\S *?) [^>] *>. *? | <. *? />
Commentary: The version circulated on the Internet is too bad. The above one can only match parts. It is still powerless for complex nested tags.

Regular expression that matches leading and trailing whitespace characters: ^\s * |\s * $
Comment: Can be used to remove whitespace at the beginning and end of a line (including spaces, tabs, form feeds, etc.), very useful expressions

Regular expression matching email address:\w + ([-+.]\w +) * @\w + ([-.]\w +) *\.\w + ([-.]\w +) *
Commentary: Useful for form validation

Regular expression matching URL URL: [a-zA-z] +: // [^\s] *
Commentary: The version circulated on the Internet has limited functions. The above can basically meet the needs.

Whether the account number is valid (beginning with a letter, 5-16 bytes are allowed, and alphanumeric underscores are allowed): ^ [a-zA-Z] [a-zA-Z0-9 _] {4,15} $
Commentary: Useful for form validation

Match domestic phone number:\d {3} -\d {8} |\d {4} -\d {7}
Commentary: Matches such as 0511-4405222 or 021-87888822

Match QQ number: [1-9] [0-9] {4,}
Commentary: Tencent QQ number starts from 10000

Match Chinese postal code: [1-9]\d {5} (?!\d)
Commentary: China postcode is 6 digits

Match ID:\d {15} |\d {18}
Commentary: Chinese ID is 15 or 18

Match IP address:\d +\.\d +\.\d +\.\d +
Commentary: Useful when extracting IP addresses

Match specific numbers:
^ [1-9]\d * $ // Match a positive integer
^-[1-9]\d * $ // Match a negative integer
^-? [1-9]\d * $ // Match an integer
^ [1-9]\d * | 0 $ // Match non-negative integer (positive integer + 0)
^-[1-9]\d * | 0 $ // Match a non-positive integer (negative integer + 0)
^ [1-9]\d *\.\d * | 0\.\d * [1-9]\d * $ // Match positive floating point numbers
^-([1-9]\d *\.\d * | 0\.\d * [1-9]\d *) $ // Match negative floating point number
^-? ([1-9]\d *\.\d * | 0\.\d * [1-9]\d * | 0?\.0 + | 0) $ // match floating point number
^ [1-9]\d *\.\d * | 0\.\d * [1-9]\d * | 0?\.0 + | 0 $ // Match non-negative floating point number (positive floating point number + 0)
^ (-([1-9]\d *\.\d * | 0\.\d * [1-9]\d *)) | 0?\.0 + | 0 $ // Match non-positive floating-point numbers (negative floating-point numbers + 0)
Comment: useful when dealing with large amounts of data, pay attention to correction when specific applications

Matches a specific string:
^ [A-Za-z] + $ // Matches a string of 26 English letters
^ [A-Z] + $ // Matches a string of 26 English capitals
^ [a-z] + $ // Matches a string of 26 lowercase English letters
^ [A-Za-z0-9] + $ // Matches a string of numbers and 26 English letters
^\w + $ // Matches a string consisting of numbers, 26 English letters, or underscores
Commentary: The most basic and most commonly used expressions


Email: [_a-z0-9-] + (\. [_ A-z0-9-] +) * @ [a-z0-9-] + (\. [A-z0-9-] +) + $
Or: w + ([-+.] W +) * @ w + ([-.] W +) *. W + ([-.] W +) *

Regular expression matching Chinese characters: [u4e00-u9fa5]
Match double-byte characters (including Chinese characters): [^ x00-xff]
Regular expression matching empty lines: n [s |] * r
Regular expressions that match HTML tags: /<(.*)>.*|<(.*) /> /
Regular expression matching leading and trailing spaces: (^ s *) | (s * $)
Match IP address:\d +\.\d +\.\d +\.\d +

Regular expression matching URL: ^ [a-zA-z] +: // (w + (-w +) *) (. (W + (-w +) *)) * (? S *)? $
Whether the account is valid (beginning with a letter, 5-16 bytes are allowed, and alphanumeric underscores are allowed): ^ [a-zA-Z] [a-zA-Z0-9 _] {4,15} $
Match domestic phone number: (d {3}-| d {4}-)? (D {8} | d {7})?
Match ID:\d {15} |\d {18}
Match Tencent QQ number: ^ [1-9] * [1-9] [0-9] * $
Regular expression that matches Chinese characters: [\u4e00-\u9fa5]
Match double-byte characters (including Chinese characters): [^\x00-\xff]
Regular expression matching empty lines:\n [\s |] *\r
Regular expressions that match HTML tags: /<(.*)>.*<\/\1>|<(.*)\/> /
Regular expressions matching leading and trailing spaces: (^\s *) | (\s * $) (a trim function like vbscript)
Regular expression matching email address:\w + ([-+.]\w +) * @\w + ([-.]\w +) *\.\w + ([-.]\w +) *
Regular expression matching URL URL: http: // [[\w-] +\.) + [\w-] + (/ [\w- ./?%&=]*)?
Reply

Use magic Report

1

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-1-26 18:36:01
| Show all posts
Wow, it's so comprehensive upstairs.
Reply

Use magic Report

2

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-26 19:27:01
| Show all posts
Can idiots be more detailed! I just learned this soon
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-17 14:15:01
| Show all posts
learned
Reply

Use magic Report

0

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-6-17 13:30:01
| Show all posts
The conditions given are incomplete
The string "Obtained Qingdao City, Shandong Province"
"Qingdao" is added between "province" and "city".
But there are multiple characters before "Province", how can it be split?
Or is your string originally "Qingdao City, Shandong Province" or "Harbin City, Heilongjiang Province", which only includes provinces and cities, rather than extracting specific provinces and cities from a certain string?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list