Could you tell me how to write a regular expression: 44,112, 2? it doesn't seem easy to write! Ladies and gentlemen!

Source: Internet
Author: User
Ask a regular expression for writing: 1, 33, 44,112, 2. it does not seem easy to write! Thank you !!! At last, this post was edited by vencie from 2013-02-2221:0. ask for a regular expression: & nbsp; 44,112, 2, that is, the numbers separated by commas. ask a regular expression for writing: 1, 33, 44,112, 2. it does not seem easy to write! Thank you !!!

This post was last edited by vencie at 21:02:30

Ask for a regular expression: 1, 33, 44,112, 2

That is, the numbers separated by commas.

There are two requirements:
1. the beginning and end cannot contain commas
2. the comma in the middle cannot appear twice in a row.

I tried this method, but it is not feasible:
^ [0-9] * {[,]? [0-9] *} * $"

Help!

Regular expression


------ Solution --------------------
/^ (\ D +,) {1,} \ d + $/
------ Solution --------------------
Write in this way
/^ (? : \ D +,) * \ d + $/

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.