(str)
string literals
clojure
(str val?)Where:
- val: string value to match *
Matching:
- single-quoted strings, e.g.
'hello' - double-quoted strings, e.g.
"hello" - template string fragments, e.g.
`hello` - JSX text content, e.g.
<div>text</div>
Behavior
- Matches string literals in any quote style.
- Also matches non-empty JSX text content.
- Template string fragments within backticks are matched, but not the template expressions.
Examples
Find hardcoded API endpoints before moving them to configuration.
clojure
(str /https?:\/\/.+/)Selects in lines { 1, 3 } but not in { 2 }:
typescript
fetch('https://api.example.com/users')
fetch(API_URL + '/users')
const url = 'http://localhost:3000'Locate console.log statements with specific debug prefixes for cleanup.
clojure
(call (mem log console) (arg 1 (str /^\[DEBUG\]/)))Selects in lines { 1 } but not in { 2, 3 }:
typescript
console.log('[DEBUG] User loaded', user)
console.log('[INFO] Server started')
console.error('[DEBUG] Failed')Find JSX components with hardcoded text before internationalization.
clojure
(jsx _ _ (child _ (str /english/i)))Selects in lines { 1, 3 } but not in { 2 }:
typescript
<div>English text here</div>
<span>Translated content</span>
<p>This is in English</p>Arguments
val
• Identifier • String • Pattern
Does NOT support: Composition — Free-form Selection — Refinement — Replacement