regex - Match start-of-search position in elisp regexp -


i doing parsing in elisp, , have string have partially consumed (let's assume value "foobar123"). suppose i've consumed "foobar" (so know need start parsing char 6) , expecting consume 2.

i've tried following, , none of them want.

(string-match "2" "foobar123" 6) ; matches `2` @ character 7. (string-match "^2" "foobar23" 6) ; not @ beginning of line. (string-match "\\`2" "foobar23" 6) ; not @ beginning of string. 

i have had success pulling out substring , matching against (i.e., (string-match "^2" (substring "foobar23" 6))), seems wasteful. feel want special character means "match @ start of search only", can't find one. there better way?

there no such regexp syntax i'm aware of.

an alternative solution insert string buffer, move point consume string , use \= construct match point.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -