Brennan Stehling on Nostr: npub1p9kjc…m865w You can do this. I add boundaries and used the range from the ...
npub1p9kjc5uauqdfphar82xmq573tf3hnh3mcugkw3t6mjg2y76xkd3sum865w (npub1p9k…865w) You can do this. I add boundaries and used the range from the match on the input.
```
let inputs = ["A cat meowed", "A dog barked"]
let regex = /\b[a-z]{3}\b/
for input in inputs {
if let match = input.firstMatch(of: regex) {
print("Match:", input[match.range])
}
}
// loop over all matches
for input in inputs {
for match in input.matches(of: regex) {
print("Match:", input[match.range])
}
}
```
Published at
2023-09-12 04:20:57Event JSON
{
"id": "8f341483d9e7a4734a1341490413ab21b5896aac5311a65ec7132578f30fe7a8",
"pubkey": "f544148e6562cf9126b3e8e478c00a69f4203cab2a95ab220764ae6c64df27f1",
"created_at": 1694492457,
"kind": 1,
"tags": [
[
"p",
"096d2c539de01a90dfa33a8db053d15a6379de3bc71167457adc90a27b46b363",
"wss://relay.mostr.pub"
],
[
"p",
"de6adda4d139627ce8f9cf05ef27c7cd1de9895363e5f303667f761bec318716",
"wss://relay.mostr.pub"
],
[
"e",
"b1c166ec294526180b2b83d6bd1a1b240a3e980dcb942b773f99200a1fe981e5",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://sfba.social/users/brennansv/statuses/111050257668763643",
"activitypub"
]
],
"content": "nostr:npub1p9kjc5uauqdfphar82xmq573tf3hnh3mcugkw3t6mjg2y76xkd3sum865w You can do this. I add boundaries and used the range from the match on the input.\n\n```\nlet inputs = [\"A cat meowed\", \"A dog barked\"]\nlet regex = /\\b[a-z]{3}\\b/\nfor input in inputs {\n if let match = input.firstMatch(of: regex) {\n print(\"Match:\", input[match.range])\n }\n}\n// loop over all matches\nfor input in inputs {\n for match in input.matches(of: regex) {\n print(\"Match:\", input[match.range])\n }\n}\n```",
"sig": "b3e1371853d792f77c27a7737d01126f7c361b87c3fa58bc3a834d1168d92ca449f9454f876db552f825dccbda459ff43f46612ad9f7a383b442760d1b619098"
}