regex - Regular expression to get string between string to particular position number -


i have tried capture string between start , end characters

example:

string: input type="hidden" title="tzdetect.pref.tzid" value="asia/kolkata"

starts with: title="tzdetect.pref.tzid" value="

ends with: "

regular expression: (?<=title="tzdetect.pref.tzid" value=")(.*?)(?=")

result: asia/kolkata

now, i'm trying string between start character particular position number.

example:

string: input type="hidden" title="tzdetect.pref.tzid" value="asia/kolkata"

starts with: title="tzdetect.pref.tzid" value="

ends with: 12th or 13th character

result should be: asia/kolkata (if 12) or asia/kolkata" (if 13)

how achieve this?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

Python Tornado package error when running server -