parsing - Capturing groups and money symbol in Regex -
I am trying to write a regular expression that takes the string and parses it into three separate capturing groups : $ 3.99 APP Download ???? 200 11/19 a ???? 1/21 3.99 Group 1: $ 3.99 Download APP 200 Groups 2: 11/2 9 A ???? 1/28 Group 3: 3. 99
Do anyone have any ideas ???
I do not have much experience with capturing groups and I do not know how to make them.
I believe that this expression will work to identify dates?
/ (\ d {2} \ / \ d {2}) / Any help would be appreciated!
:
([$] \ d + [.] \ D {2}. * (\ D?) \ * S {1,2} / \ d {2}. *? \ D {1,2} / \ d {2}) \ s (\ d + [ .] \ D {2}) So with it we have 3 capture groups ( () ) different from \ s * , Which means 0 + white space of the alphabet (this is not necessary, but it will remove the back space from your occupied groups).
The first capture group [$] \ d + [.] \ D {2}. *? matches a dollar sign, after 1 + digit, after a period, after 2 digits, after a lazy match of 0+ characters (. *? ) In our expression (in this case, our next capture group) matches anything of this lazy match till next match.
Our second capture group is \ d {1,2} / \ d {2}. *? \ D {1,2} / \ d {2} matches 1-2 digits, a slash, and 2 points, then we use any lacrimal match of any other character.
Our final capture group will be \ d + [.] \ D {2} 1 + digit, one duration, and 2 more digits.
Note: I used ~ as a delimiter so that we do not need to get rid of our / dates In addition to this, I have $ and . I put in character classes, because I think it looks cleaner than avoiding them ( [$] versus \ $ ) .. either Works :)
Comments
Post a Comment