I am attempting to create a cursoring subroutine that will allow me to create what I call a slice navigation string.

My script allows for a "&slice=" parameter to indicate what slice to show. This works along with my "&max=" parameter to indicate how many records to show per slice.

What I will have is a $ENV{'REQUEST_URI'} whice will contain the "slice=" string in it along with a number. There are however 3 possibilities; they are:

     FIRST PARAM: slice=[SOME_NUMBER]&this=that
MIDDLE-ISH PARAM: this=that&slice=[SOME_NUMBER]&that=this...
      LAST PARAM: this=that&that=this&slice=[SOME_NUMBER]

What I am looking for is a regex that would create a pre and post string that would do the equivilant of (using the first example:

     $pre = "slice="
     $post = "&this=that"

so that I can loop and insert numbers into my new URI

     slice=1&this=that
     slice=2&this=that
     slice=3&this=that
     ...
     slice=100&this=that
     .....

and so on, and so on. I've been trying to do this myself but have had no luck in getting a regex to address all three scenarios.

TIA

======================
Sean Shrum
http://www.shrum.net

Fixed square brackets 2002-02-27 - dvergin


In reply to Need to create a pre and post string from a REQUEST_URI by S_Shrum

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.