Results 1 to 5 of 5

Thread: RegEX help please?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517

    RegEX help please?

    I want to go through a scalar and every 35 character put a <br> in the string.

    Id like to do this with a regex, but im not sure how..


    any ideas?

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    why with regexp?
    what do you mean by scalar? a string?
    Have I helped you? Please Rate my posts.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    1. Which language? - some languages have functions which do this.
    2. Why regular expressions?
    3. What kind of characters do you want to match (if any). I.e. letters and numbers, any character, just numbers???
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Code:
    str = "this is a very long string which will have br's stuck in it, possibly in wierd places but who gives a rat's arse about that little detail. Well, we'll see if this untested code will work, I sure hope so"
    for (i=35;i<str.length;i=i+35)
      {
      str=str.substring(0,i)+"<br>"+str.substring(i+1,str.length)
      }
    
    document.write(str)
    doesn't use reg exp though
    Have I helped you? Please Rate my posts.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    html =)

    Found out how..


    <div style="position:absolute;width:400"> Text here </div>


    That will word wrap it without coding anything =-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width