Open trinker opened 8 years ago
#http://www.regexlib.com/UserPatterns.aspx?authorId=dd782f8f-82a2-45e6-8e77-00a9647e1aac
#jared cook
pat <- '(-?[1-9](\\.\\d+)?)((\\s?[X*]\\s?10[E^]([+-]?\\d+))|(E([+-]?\\d+)))'
ex_scientific_notation <- ex_(pattern=pat)
txt <- "negative numbers. Make sure to use a case insensitive pattern matcher. Group 1 is the significand, and either group 5 or group 7 is the exponent (one or the other will be null, but never both).
Matches
1.1 x 10^9 | 2.34 X 10^12 | 3.14159 * 10^30 | 1.1x10^9 | 2.34X10^12 | 3.14159*10^30 | 1.1 x 10e9 | 2.34 x 10E12 | 3.14159e30 | 1.1 x 10^-9 | 2.34 X 10^-12 | 3.14159E-30 | -1.1 x 10^9 | -2.34 X 10E12 | -3.14159 * 10e30 | -1.1x10^-9 | -2.34E-12 | -3.14159e-30 | 3.1459E+030 | 1x10^9 | 1E9
Non-Matches
0.1 x 10^"
ex_scientific_notation(txt)
#http://www.regexlib.com/REDetails.aspx?regexp_id=2288
#Art Araya
pat <- '(?:(?:[123]|I{1,3})\\s*)?(?:[A-Z][a-zA-Z]+|Song of Songs|Song of Solomon).?\\s*(?:1?[0-9]?[0-9]):\\s*\\d{1,3}(?:[,-]\\s*\\d{1,3})*(?:;\\s*(?:(?:[123]|I{1,3})\\s*)?(?:[A-Z][a-zA-Z]+|Song of Songs|Song of Solomon)?.?\\s*(?:1?[0-9]?[0-9]):\\s*\\d{1,3}(?:[,-]\\s*\\d{1,3})*)*'
ex_bible_verse <- ex_(pattern=pat)
txt <- "negative numbers. Make sure to use a case 2 Kings 2:11 insensitive pattern matll, but never both). Leviticus 3:3-4 | II Ki. 2:11; 3:12-22, 25 | 2Cor 3:16; Rom. 12:1-5,7,9
Non-Matches
Lev chap 3 vv3-4 | 2nd Kings 2:11 | Romans 12"
ex_bible_verse(txt)