php - Filter a version number out of a string -
i want filter number out of string php preg_match (they versions of software):
- 1.6.2
- 1.6.2#2
- 1.7
(1.6.2#2 2. beta of 1.6.2)
so when there string like:
lorem ipsum dolor sit amet, consetetur sadipscing elitr, 1.6.2# sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
now want string contains "1.6.2#2"
i tried (\d?[.|#]?)*
not work
use regular expression
/(\d+\.\d+(\.\d+)?(#\d+)?)/
Comments
Post a Comment