I need to match only strings that include one character / between numbers or integer numbers.
Examples:
1 YES
1/2 YES
some_text NO
some/test NO
some NO
2///2 NO
/12 NO
1/2/ NO
1.2/3 NO
Edit:
By rubular.com i`m tried to check this regex: /\d+(\/\d+)?
How regex should looks like?
If you’re only including whole numbers or fractions:
If you also want to allow decimals:
Edit: Note that I’m making a lot of assumptions about what you really want. Bart Kiers’s comments to your question are very important — I took the liberty of assuming that what you want is numbers. If that isn’t true, please clarify the question.
Edit2: I’m also making one more important assumption. Your question says “strings that include / or integer number.” If you want to make sure that the string is ONLY a number and nothing else, then add
^to the beginning of the line and$to the end. Example: