Regex to match [integer][colon][alphanum][colon][integer] -
Regex to match [integer][colon][alphanum][colon][integer] -
i attempting match string formatted [integer][colon][alphanum][colon][integer]. example, 42100:zba01:20. need split these colon...
i'd larn regex, if could, tell me i'm doing wrong: i've been able come with...
^(\d):([a-za-z0-9_]):(\d)+$ ^(\d+)$ ^[a-za-z0-9_](:)+$ ^(:)(\d+)$
at first tried matching parts of string, these matching entire string. can tell, i'm not familiar regular expressions.
edit: regex input desktop application. i'm not 'language' or 'type' of regex use, assumed .net . need able identify each of grouped characters, split colon. grouping #1 should first integer, grouping #2 should alphanumeric group, grouping #3 should integer (ranging 1-4).
thank in advance,
darius
i assume semicolons (;
) meant colons (:
)? right, bit of basics.
^
matches origin of input. is, regular look match if finds match @ start of input. similarly, $
matches end of input. ^(\d+)$
match string consisting only of one or more numbers. because match needs start @ origin of input , stop @ end of input. in other words, whole input needs match (not part of it). +
denotes one or more matches.
with knowledge, you'll notice ^(\d):([a-za-z0-9_]):(\d)+$
close beingness right. look indicates the whole input needs match:
the problem in 1 , 3. need add together +
quantifier there match one or more times instead of once. also, want place these quantifiers inside capturing groups in order multiple matches within 1 capturing grouping opposed receiving multiple capturing groups containing single matches.
^(\d+):([a-za-z0-9_]+):(\d+)$
regex
Comments
Post a Comment