perl - Regex: extract a number from a string and place it in a new string -



perl - Regex: extract a number from a string and place it in a new string -

i replace portion of text in pdf using changepagestring.pl - search , replace in pdf pages (http://search.cpan.org/dist/cam-pdf/bin/changepagestring.pl). tool needs 2 regex strings: replace , replace code. here comes code replace:

if (this.hostcontainer) { seek { this.hostcontainer.postmessage(['newpage', 'pp_322', 15259]); } catch(e) { console.println(e); } };

the portion pp_322 varies , and number 322 example. regex should match if character(s) after pp_ standard arabic numerals (0-9).

i extract number , set code:

this.zoomtype = zoomtype.pref; this.pagenum = extractednumber-16;

edit:

i think bit closer. code works perchance buggy.

(?<=pp_)\d+(?:\'\d+)?

this can find number want (possibly buggy code), how set extractednumber into?

this.pagenum = extractednumber-16;

thanks help.

regex perl pdf cam-pdf

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -