Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4019cc0

Browse files
committed
readme
1 parent 7585649 commit 4019cc0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
```ruby
66
#!/usr/bin/env ruby
77
require 'regexp_trie'
8+
89
# like Regexp.union()
9-
p RegexpTrie.union(%w(foobar fooxar foozap fooza)) # (?-mix:foo(?:bar|xar|zap?))
10+
p RegexpTrie.union(%w(foobar fooxar foozap fooza)) # /foo(?:bar|xar|zap?)/
11+
p RegexpTrie.union(%w(foobar fooxar foozap fooza), option: Regexp::IGNORECASE) # /foo(?:bar|xar|zap?)/i
1012

1113
# or object-oriented interface
1214
rt = RegexpTrie.new
1315
%w(foobar fooxar foozap fooza).each do |word|
1416
rt.add(word)
1517
end
16-
p rt.to_regexp # (?-mix:foo(?:bar|xar|zap?))
18+
p rt.to_regexp # /foo(?:bar|xar|zap?)/
1719
```
1820

1921
See also the original [Regexp::Trie in Perl](https://metacpan.org/pod/Regexp::Trie).

‎example/synopsis.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env ruby
22
require 'regexp_trie'
3+
34
# like Regexp.union()
45
p RegexpTrie.union(%w(foobar fooxar foozap fooza)) # /foo(?:bar|xar|zap?)/
6+
p RegexpTrie.union(%w(foobar fooxar foozap fooza), option: Regexp::IGNORECASE) # /foo(?:bar|xar|zap?)/i
57

68
# or object-oriented interface
79
rt = RegexpTrie.new

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /