SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is the asp function equivelent to the php eregi function?

    For those who do not know the php code for it is:
    PHP Code:
    <?php
    $string 
    'XYZ';
    if (
    eregi('z'$string)) {
       echo 
    "'$string' contains a 'z' or 'Z'!";
    }
    ?>
    So basically it tells if it includes something it outputs something.
    Have a good day.

  2. #2
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also can you provide a sample? Thanks.
    Have a good day.

  3. #3
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind found it! A french site made it!

    http://www.comscripts.com/sources/asp_eregi-asp_98.html
    Have a good day.

  4. #4
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not an "ASP function"... ASP is the script host, not the language.

    VBScript (or JScript) are languages, and both offer regular expression capabilities, which are fully documented in the freely downloadable scripting reference available here:
    http://www.microsoft.com/downloads/d...displaylang=en

    (hint hint )
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  5. #5
    SitePoint Member
    Join Date
    Jun 2004
    Location
    UK
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use something like the InStr function like so

    <%
    strString = "xyz"

    intWhere = InStr(strString, "z")
    'Response.Write (intWhere)

    if intWhere <> 0 Then
    Response.Write "The string " & strString & " contains a z or Z"
    end if
    %>

    So if the letter you are looking for is in the string InStr will return where the character is in the string as an integer that you can use in the if statement


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
  •