I'm trying to extract the chapter number from the text "Chapter 3" which is a previous find from the cursor position. I'm trying to use the following
$sels = $doc.text.find '(?<=Chapter )[[:digit:]](?=\\n)', 'Er-Wr', '-am'
How do I get the number three from $sels it just gives me ranges. I'm not quite hip to this type of coding any help and education appreciated.
thanks
Lou
Need some help I don't quite get all this dot stuff
Re: Need some help I don't quite get all this dot stuff
You can get the number by $n = $sels.subtext or $n = $sels.substring but find command does not know where the cursor is positioned and, with r option, always searches from the end of the document. Try the following instead:loulesko wrote:I'm trying to extract the chapter number from the text "Chapter 3" which is a previous find from the cursor position. I'm trying to use the following
$sels = $doc.text.find '(?<=Chapter )[[:digit:]](?=\\n)', 'Er-Wr', '-am'
How do I get the number three from $sels it just gives me ranges.
Code: Select all
Find '(?<=Chapter )[[:digit:]]+(?=\n)', 'Er-W', '-am'
$n = Read Selection
Prompt $n
Code: Select all
$i = Find '(?<=Chapter )[[:digit:]]+(?=\n)', 'Er-W', '-am'
if $i
$n = Read Selection
Prompt $n
else
Prompt 'Chapter number not found'
end
• You don’t need putting two \ before n although Macroize does.
Re: Need some help I don't quite get all this dot stuff
Kino,
Amazing. Thank you again for all your help.
best
Lou
Amazing. Thank you again for all your help.
best
Lou