Permalink
Browse files

update readme

  • Loading branch information...
1 parent 7e92443 commit 4a88361b5e62ce97a951d24695f01bd90c63a0b0 @igrigorik committed May 8, 2011
Showing with 44 additions and 62 deletions.
  1. 0 .rspec
  2. +44 −0 README.md
  3. +0 −62 README.rdoc
View
0 .rspec
No changes.
View
@@ -0,0 +1,44 @@
+# TextQuery
+
+Does it match? When regular expressions are not enough, textquery is the answer. For
+example, regular expressions cannot evaluate recursive rules and often result in
+overly verbose and complicated expressions.
+
+Textquery is a simple PEG grammar with support for:
+
+- AND (spaces are implicit AND's)
+- OR
+- NOT (- is an alias)
+- 'quoted strings'
+- fuzzy matching
+- case (in)sensitive
+- custom delimeters
+
+## Example
+
+```ruby
+TextQuery.new("'to be' OR NOT 'to_be'").match?("to be") # => true
+
+TextQuery.new("-test").match?("some string of text") # => true
+TextQuery.new("NOT test").match?("some string of text") # => true
+
+TextQuery.new("a AND b").match?("b a") # => true
+TextQuery.new("a AND b").match?("a c") # => false
+
+q = TextQuery.new("a AND (b AND NOT (c OR d))")
+q.match?("d a b") # => false
+q.match?("b") # => false
+q.match?("a b cdefg") # => true
+
+TextQuery.new("a~").match?("adf") # => true
+TextQuery.new("~a").match?("dfa") # => true
+TextQuery.new("~a~").match?("daf") # => true
+TextQuery.new("2~a~1").match?("edaf") # => true
+TextQuery.new("2~a~2").match?("edaf") # => false
+
+TextQuery.new("a", :ignorecase => true).match?("A b cD") # => true
+```
+
+## License
+
+The MIT License - Copyright (c) 2011 Ilya Grigorik
View
@@ -1,62 +0,0 @@
-= TextQuery
-
-Does it match? When regular expressions are not enough, textquery is the answer. For
-example, regular expressions cannot evaluate recursive rules and often result in
-overly verbose and complicated expressions.
-
-Textquery is a simple PEG grammar with support for:
-- AND (spaces are implicit AND's)
-- OR
-- NOT (- is an alias)
-- 'quoted strings'
-- fuzzy matching
-- case (in)sensitive
-- custom delimeters
-
-== Example
-
- TextQuery.new("'to be' OR NOT 'to_be'").match?("to be") # => true
-
- TextQuery.new("-test").match?("some string of text") # => true
- TextQuery.new("NOT test").match?("some string of text") # => true
-
- TextQuery.new("a AND b").match?("b a") # => true
- TextQuery.new("a AND b").match?("a c") # => false
-
- q = TextQuery.new("a AND (b AND NOT (c OR d))")
- q.match?("d a b") # => false
- q.match?("b") # => false
- q.match?("a b cdefg") # => true
-
- TextQuery.new("a~").match?("adf") # => true
- TextQuery.new("~a").match?("dfa") # => true
- TextQuery.new("~a~").match?("daf") # => true
- TextQuery.new("2~a~1").match?("edaf") # => true
- TextQuery.new("2~a~2").match?("edaf") # => false
-
- TextQuery.new("a", :ignorecase => true).match?("A b cD") # => true
-
-== License
-
-(The MIT License)
-
-Copyright (c) 2009 Ilya Grigorik
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit 4a88361

Please sign in to comment.