Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #160 // match (for database 1)

Lua code

function match(input, pattern)
  if input == nil then return false end
  --assert(input, "input is nil")
  pattern = pattern:gsub("<number>", "([0-9]+)")
  pattern = pattern:gsub("<string>", '"([^"]*)"')
  return input:match(pattern)
end

Author comment

Began life as a copy of #139

test run  test run with input  download  show line numbers   

Relations

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
299 #1000604 (pitcher) 2015-08-18 00:54:51
256 #1000610 (pitcher) Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
function match(input, pattern)
if input == nil then return false end
--assert(input, "input is nil")
pattern = pattern:gsub("<number>", "([0-9]+)")
pattern = pattern:gsub("<string>", '"([^"]*)"')
return input:match(pattern)
end
}}
2015-08-18 00:53:10

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 243 [visualize]

Snippet ID: #160
Snippet name: match (for database 1)
Eternal ID of this version: #160/1
Text MD5: 9d2aca3ed3fdb309494d528caff282b6
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-01-14 02:30:58
Source code size: 243 bytes / 7 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 1183 / 232
Referenced in: [show references]