Alpha Video Training
Results 1 to 9 of 9

Thread: <HELP> regex grep </HELP>

  1. #1
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default <HELP> regex grep </HELP>

    I'm trying to strip out the \n character from an html file only when it falls between an opening and closing html tag.

    eg. <BODY>some text here \n
    the rest of the text here after the newline in red.</BODY>

    I'm trying to get rid of the newline.

    The documentation on regex_grep leaves much to be desired. I am trying something like the following:

    Code:
     DIM string as C
    string = regex_grep(filename, "s/<(.*?)\n(.*?)>\1\2/g:", "/0")
    it doesn't return anything...

  2. #2
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: <HELP> regex grep </HELP>

    Jeff,

    Did you see the link on top of the regex documentation?

    Maybe not so much of direct help but nevertheless.

    Added:
    Jeff looking at the function, it wants a string at the position you put the filename. Dit you use something like :
    Code:
    dim cc as C
    cc = file.to_string("c:\ALPHA4V8\README.TXT")
    ? regex_grep(cc, "(W|w)indows", "$(LINETEXT)" + crlf() )
    =Running With Windows 95
    Using Alpha Four with Microsoft Windows for Workgroups
    Running With Windows 95
    Four to crash when running Windows 95. To avoid this problem, do the
    Using Alpha Four with Microsoft Windows for Workgroups
    To configure Windows for Workgroups to work properly with Alpha Four,
    Field Rules: Lookup Windows can Now Use Custom Column Headings and Custom
    Did you also tried: UI_REGEX_BUILDER()
    Last edited by Marcel Kollenaar; 11-13-2006 at 04:50 PM. Reason: Found some more information in help file.
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  3. #3
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: <HELP> regex grep </HELP>

    Quote Originally Posted by Marcel Kollenaar View Post
    Jeff,

    Did you see the link on top of the regex documentation?

    Maybe not so much of direct help but nevertheless.

    Added:
    Jeff looking at the function, it wants a string at the position you put the filename. Dit you use something like :
    Code:
    dim cc as C
     
    cc = file.to_string("c:\ALPHA4V8\README.TXT")
     
    ? regex_grep(cc, "(W|w)indows", "$(LINETEXT)" + crlf() )
     
    =Running With Windows 95
     
    Using Alpha Four with Microsoft Windows for Workgroups
     
    Running With Windows 95
     
    Four to crash when running Windows 95. To avoid this problem, do the
     
    Using Alpha Four with Microsoft Windows for Workgroups
     
    To configure Windows for Workgroups to work properly with Alpha Four,
     
    Field Rules: Lookup Windows can Now Use Custom Column Headings and Custom
    Marcel,

    I am working on trying that... Since the Regex functions expect a string does that mean I'm stuck with the 255 character limitation?

  4. #4
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: <HELP> regex grep </HELP>

    Quote Originally Posted by Jeff@Listbrokers View Post
    Marcel,

    I am working on trying that... Since the Regex functions expect a string does that mean I'm stuck with the 255 character limitation?
    No. When a string becomes larger than 1024 bytes it will transform into a blob, but working with it is the same.

    The only limit I've seen of 255 chars are the type-in-fields on the form.
    Last edited by Marcel Kollenaar; 11-13-2006 at 05:13 PM.
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  5. #5
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: <HELP> regex grep </HELP>

    Quote Originally Posted by Marcel Kollenaar View Post
    No. When a string becomes larger than 1024 bytes it will transform into a blob, but working with it is the same.

    The only limit I've seen of 255 chars are the type-in-fields on the form.
    That's good to know. :) I haven't seen that in the documentation yet. :)

    no clue on the regex to strip out the \r\n characters when they fall between an opening < and a closing > character, huh?

  6. #6
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: <HELP> regex grep </HELP>

    Not very quickly...:cool:

    Did you type:
    Code:
    ?UI_REGEX_BUILDER()
    in the interactive window, You see a regexpression builder maybe that will help you.
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

  7. #7
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: <HELP> regex grep </HELP>

    Quote Originally Posted by Marcel Kollenaar View Post
    Not very quickly...:cool:

    Did you type:
    Code:
    ?UI_REGEX_BUILDER()
    in the interactive window, You see a regexpression builder maybe that will help you.
    Thanks Marcel, I really appreciate your help. I hadn't heard of that command yet, but I'll definitely give it a try.

  8. #8
    Member
    Real Name
    Jeffrey Walter
    Join Date
    Sep 2006
    Posts
    304

    Default Re: <HELP> regex grep </HELP>

    turns out... I should have been using REGEX_MATCH()

    here's what worked:


    DIM htmlpage as C (holds the text file I want to perform the regex on)

    ' This removes the CRLF's that were occuring inside of my HTML tags.
    Code:
     
    Example: <B> here is some text < CRLF
    /B> <--- the tag won't display properly when I render my HTML page.
     
    htmlpage = regex_merge(htmlpage,"<(\w*)\r?\n?"+chr(13)+chr(10),"<\1","AI")
     
    Result: <B> here is some text </B>
    ' This removed the CRLF's that were occuring between two tags.
    Code:
    Example: <B> here is some text CRLF
    this whole line is now seperated when I render my HTML page. </B>
    
     
    htmlpage = regex_merge(htmlpage,">(\w*)\r?\n?"+chr(13)+chr
    (10),">$1","AI")
     
    Result: <B> here is some text this whole line is now seperated when I render my HTML page. </B>

  9. #9
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Re: <HELP> regex grep </HELP>

    :)
    Marcel

    I hear and I forget. I see and I remember. I do and I understand.
    ---- Confusius ----

Bookmarks

Posting Permissions

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