String matching: Difference between revisions

m
→‎{{header|BQN}}: Split definition and usage
m (→‎{{header|BQN}}: Split definition and usage)
Line 1,205:
 
<code>⍷</code> does much of the heavy lifting here. It is commuted with <code>˜</code> so the order of the arguments makes sense.
<lang bqn>SW ← ⊑⍷˜
<lang bqn>SW ← ⊑⍷˜
 
⊑⍷˜
Contains ← ∨´⍷˜
Contains ← ∨´⍷˜
 
∨´⍷˜
EW ← ¯1⊑⍷˜
EW ← ¯1⊑⍷˜
 
¯1⊑⍷˜
Locs ← /⍷˜</lang>
{{Out|Usage}}
/⍷˜
<lang bqn> "abcd" SW "ab"
1
"abcd" SW "cd"
Line 1,231:
"abab" Locs "ab"
⟨ 0 2 ⟩</lang>
 
=={{header|Bracmat}}==
Bracmat does pattern matching in expressions <code><i>subject</i>:<i>pattern</i></code> and in strings <code>@(<i>subject</i>:<i>pattern</i>)</code>. The (sub)pattern <code>?</code> is a wild card.
99

edits