Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>Running this script:</p> <table class="wysiwyg-macro" data-macro-name="code" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGV9&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> import java.util.regex.Pattern keypadMap = [0:"", 1:"", 2:"abc", 3:"def", 4:"ghi", 5:"jkl", 6:"mno", 7:"pqrs", 8:"tuv", 9:"wxyz"] dictionary = new File("words") regexBuilder = { digit -> '[' + keypadMap[digit.toInteger()] + ']' } patternBuilder = { number -> Pattern.compile('^' + number.collect(regexBuilder).join() + '$') } def matchWords(phNumber) { def p = patternBuilder(phNumber) def matches = [] dictionary.eachLine{ line -> if (p.matcher(line).matches()) matches << line } if (matches) println "Matches for $phNumber: " + matches.join(' ') else println "No matches found for $phNumber" } def matchPairs(phNumber) { def p1 = patternBuilder(phNumber[0..2]) def p2 = patternBuilder(phNumber[3..6]) def first = [], second = [] dictionary.eachLine { line -> if (p1.matcher(line).matches()) first << line if (p2.matcher(line).matches()) second << line } if (first && second) println "$phNumber matches word pairs: " + [first, second].combinations().collect{ it.join '-' }.join(', ') else println "Couldn't find word pair for $phNumber" } [ '2345678', '2455466', '2276228', '6662342', '2476642', '2742742', '7338433', '7678243', '3742253', '7264253', '7683353', '7684453', '7837453', '7378453', '3749953', '7877363', '2668363', '5367273', '7377473', '7877673', '7278873', '2646283', '3377483' ].each{ matchWords it } println '----------------' [ '8765432', '9689474', '2896673', '6847687', '9687283', '2283278' ].each{ matchPairs it } </pre></td></tr></table> <p>against the attached <a class="confluence-link unresolved" data-filename="words" data-linked-resource-default-alias="words" href="#"><code>words</code></a> file yields these results:</p> <table class="wysiwyg-macro" data-macro-name="noformat" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e25vZm9ybWF0fQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> No matches found for 2345678 Matches for 2455466: billion Matches for 2276228: acrobat Matches for 6662342: monadic nomadic Matches for 2476642: chromic chronic Matches for 2742742: aphasia aphasic Matches for 7338433: refugee seethed Matches for 7678243: portage postage Matches for 3742253: dribble friable Matches for 7264253: panicle sanicle Matches for 7683353: snuffle souffle Matches for 7684453: smuggle snuggle Matches for 7837453: puerile sterile Matches for 7378453: reptile servile Matches for 3749953: drizzle frizzle Matches for 7877363: supreme suspend Matches for 2668363: contend convene Matches for 5367273: jeopard leopard Matches for 7377473: reprise respire Matches for 7877673: purpose suppose Matches for 7278873: pasture rapture Matches for 2646283: animate cognate Matches for 3377483: deprive despite ferrite ---------------- Couldn't find word pair for 8765432 9689474 matches word pairs: you-wish 2896673 matches word pairs: buy-more, buy-nose 6847687 matches word pairs: mug-pour, mug-soup, mug-sour 9687283 matches word pairs: you-pate, you-pave, you-rate, you-rave, you-save, you-scud 2283278 matches word pairs: act-dart, bat-dart, cat-dart, act-east, bat-east, cat-east, act-fast, bat-fast, cat-fast </pre></td></tr></table>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced