regex_test.rb in elib_mgmt-cli-0.1.7 vs regex_test.rb in elib_mgmt-cli-0.1.8
- old
+ new
@@ -1,37 +1,56 @@
t = []
-t << "art-of-computer-programming-"
-t << "the-art-of-programming"
-t << "the.art.of.programming"
-t << "the_art_of_programming"
-t << "art.of.taling"
-t << "whatever there"
-t << "art of whatever"
-t << "tart.is.delicious"
-t << "the-art.of-sing"
-t << "nothing here"
-t << " art-anter"
-t << "Bug Bounty Playbook"
-t << "the art"
-t << "this is (art) of bounty"
-t << "r-quick-syntax-reference.9781430266402.65848"
+#t << "art-of-computer-programming-"
+#t << "the-art-of-programming"
+#t << "the.art.of.programming"
+#t << "the_art_of_programming"
+#t << "art.of.taling"
+#t << "whatever there"
+#t << "art of whatever"
+#t << "tart.is.delicious"
+#t << "the-art.of-sing"
+#t << "nothing here"
+#t << " art-anter"
+#t << "Bug Bounty Playbook"
+#t << "the art"
+#t << "this is (art) of bounty"
+
+# test beginning
t << "r-cookbook-oreilly-cookbooks"
-t << "using-r-for-data-analysis-in-social-sciences.9780190656225.90561"
-t << "a-data-scientists-guide-to-acquiring-cleaning-and-managing-data-in-r.9781119080022.73583"
+t << "r.dotbook"
+t << "R.dotbook"
+t << "r space"
+# test middle
+t << "using-r-for-data-analysis-in-social-sciences"
+t << "using.r.for.data.analysis.in.social.sciences"
+t << "using r for data analysis in social sciences"
+t << "protein is doomed"
+t << "protein-is-doomed"
+t << "protein.is.doomed"
+t << "ginger sings"
+t << "ginger-sings"
+t << "ginger.sings"
+t << "the-earth-is-round"
+# test end
+t << "a-data-scientists-guide-to-acquiring-cleaning-and-managing-data-in-r"
name = "r"
-p t.select { |v|
- v =~ /#{name}[-,.,_,\s]/ or
- v =~ /[-,.,_,\s]#{name}[-,.,_,\s]/ or
- v =~ /[-,.,_,\s]#{name}\z/
- #v =~ /^#{name}[-,.,_,\s]/i
- #v =~ /[\(,\),-,.,_,\s]r[\(,\),-,.,_,\s]/ or
- #v =~ /[\(,\),-,.,_,\s]r\z/
- #v =~ /[-,.,_,\s]program\w+[-,.,_,\s]/ or
- #v =~ /program\w+[-,.,_,\s]/ or
- #v =~ /[-,.,_,\s]program\w+/
- #v =~ /[-,.,_,\s]bounty\w*[-,.,_,\s]/i
- #v =~ /[-,.,_,\s]art\z/
- #v =~ /^art[-,.,_,\s]/
+lead = t.select { |v|
+ #v =~ /#{name}[-,.,_,\s]/ or
+ #v =~ /[-,.,_,\s,^]#{name}[-,.,_,\s]/ or
+ #v =~ /[-,.,_,\s]#{name}\z/
+
+ v =~ /^#{name}[-,.,_,\s]/i
+
}
+puts "lead length : #{lead.length}"
+
+p res1
+
+#res2 = t.select do |v|
+# v =~ /[-,.,_,\s]#{name}[-,.,_,\s,\z]/i
+#end
+#puts "res2 length : #{res2.length}"
+#p res2
+