/    Sign up×
Community /Pin to ProfileBookmark

regular expressiion with OR condition

i want to build a regular expressions where
09-8855221
and
09885521
are both legal expressions how do i do that?
thnakd i nadvance
peleg

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@KorDec 30.2006 — [COLOR=DarkGreen]/[/COLOR]098855221[COLOR=Blue]|[/COLOR]09-8855221[COLOR=DarkGreen]/[/COLOR]
Copy linkTweet thisAlerts:
@mrhooDec 30.2006 — var rx= /^09-?8855221$/;

or if it is one expression in a larger pattern:

(09-?8855221)
Copy linkTweet thisAlerts:
@Mr_JDec 30.2006 — I am not really confident with regExp yet but you may be able to match the pattern using

^d{2}-?d{7}$

unless you are wanting the actual numbers to match
Copy linkTweet thisAlerts:
@pelegk1authorJan 08.2007 — the numbers i gave were just an example of the structure that i want to handle.
Copy linkTweet thisAlerts:
@forty2Jan 08.2007 — <i>
</i>/^0[1-9](?:d{6}|-d{7})$/
Copy linkTweet thisAlerts:
@disgracianJan 08.2007 — [b]/^d{2}-?d{7}$/[/b] if you want [i]any[/i] digits from 0-9 with an optional dash after the 2nd digit.

[b]/^0d-?d{7}$/[/b] is the same as above, except that the first digit must be zero.

Cheers,

D.
×

Success!

Help @pelegk1 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...