Skip to content

Instantly share code, notes, and snippets.

@kml
Created October 15, 2015 17:21
Show Gist options
  • Save kml/828b46b0bd74e46e642b to your computer and use it in GitHub Desktop.
Save kml/828b46b0bd74e46e642b to your computer and use it in GitHub Desktop.
# encoding: utf-8
phrase = "sterownik".force_encoding("utf-8")
regexp = /(?i-mx:^bram[ay])|(?i-mx:(prz[e??]s[l??][ao]|element)[a-z??????]* ogrodz[a-z??????]*)|(?i-mx:(sterowniki?|automatyka).*\bbramy?)|(?i-mx:^tralk[ai])|(?i-mx:bojlery?|pojemno.ciow[ey])|(?i-mx:[a-z]+grzewacze? wody)/
puts phrase.match(regexp).inspect
=begin
UTF8Encoding.java:35:in `length': java.lang.ArrayIndexOutOfBoundsException: 9
from BaseUTF8Encoding.java:91:in `mbcToCode'
from UTF8Encoding.java:24:in `mbcToCode'
from Encoding.java:469:in `isMbcWord'
from ByteCodeMachine.java:1054:in `opWordBound'
from ByteCodeMachine.java:239:in `matchAt'
from Matcher.java:304:in `matchCheck'
from Matcher.java:480:in `searchInterruptible'
from RubyRegexp.java:273:in `run'
from RubyThread.java:1065:in `executeBlockingTask'
from RubyRegexp.java:235:in `matcherSearch'
from RubyRegexp.java:1780:in `search19'
from RubyRegexp.java:1720:in `matchPos'
from RubyRegexp.java:1701:in `match19Common'
from RubyRegexp.java:1680:in `match_m19'
from RubyRegexp$INVOKER$i$match_m19.gen:-1:in `call'
from JavaMethod.java:354:in `call'
from RubyClass.java:742:in `finvoke'
from Helpers.java:503:in `invoke'
from RubyBasicObject.java:363:in `callMethod'
from RubyString.java:1747:in `match19'
from RubyString$INVOKER$i$match19.gen:-1:in `call'
from JavaMethod.java:354:in `call'
from CachingCallSite.java:326:in `cacheAndCall'
from CachingCallSite.java:170:in `call'
from CallOneArgNode.java:57:in `interpret'
from NewlineNode.java:105:in `interpret'
from BlockNode.java:71:in `interpret'
from RootNode.java:129:in `interpret'
from ASTInterpreter.java:121:in `INTERPRET_ROOT'
from Ruby.java:894:in `runInterpreter'
from Ruby.java:902:in `runInterpreter'
from Ruby.java:733:in `runNormally'
from Ruby.java:578:in `runFromMain'
from Main.java:395:in `doRunFromMain'
from Main.java:290:in `internalRun'
from Main.java:217:in `run'
from Main.java:197:in `main'
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment