![]() |
|
[.NET] Simple regex help - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Simple regex help (/showthread.php?tid=4846895) |
Simple regex help - shooterbret - Jun 1, 2015 I need a regex match so that it will get only digits that are in a group or 1-5 and are not surrounded by .'s or does not start with a dot. For example "id=test>23.34<\id>" would not be picked up because both are surrounded by .'s but "id=test>2354<\id>" would because it is alone.I am trying to learn regex so an explanation would help. Thanks. * - frawg - Jun 1, 2015 How many digits is the ID? Is it the same amount of digits each time or does it change?? Does it contain letters or anything other than numbers? * - shooterbret - Jun 1, 2015 (Jun 1, 2015 10:44 PM)frawg Wrote: How many digits is the ID? Is it the same amount of digits each time or does it change?? Does it contain letters or anything other than numbers? The id is 1 - 5 digits around and it does change from time to time.There is also no letters. But these 1-5 digits cannot contain a . to the left or right of them. * - LUOIdeRentA - Jun 2, 2015 I'm also learning regex. This code that you will see below could most likely be improved, but it works. PHP Code That regex code will not include .'s and include numbers 0 to 9, for whatever length. |