How to do the pattern?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yxq

    #1

    How to do the pattern?

    Hello,
    I want to get the strings that match c*.txt ( * means asterisk wildcard)
    from some strings below:

    c1234.txt
    1234.txt
    a1234.exe
    cqwer.txt
    casd.txt

    I want to use regular or function, do not want to use if....then...
    How to do?

    Thank you



  • Herfried K. Wagner [MVP]

    #2
    Re: How to do the pattern?

    "yxq" <gayxq@163.ne t> schrieb:[color=blue]
    > I want to get the strings that match c*.txt ( * means asterisk wildcard)
    > from some strings below:
    >
    > c1234.txt
    > 1234.txt
    > a1234.exe
    > cqwer.txt
    > casd.txt
    >
    > I want to use regular or function, do not want to use if....then...[/color]

    Check out the documentation of VB's 'Like' operator.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Jeff Jarrell

      #3
      Re: How to do the pattern?

      "regular expressions" are another technique to be aware of. in this case
      the regular expression is "^c".

      Get this tool and play with it. It will even generate the code for doing
      evaluating a regular expression for you.
      http://www.sellsbrothers.com/tools/#regexd



      "yxq" <gayxq@163.ne t> wrote in message
      news:eH9K9E0SGH A.5736@TK2MSFTN GP10.phx.gbl...[color=blue]
      > Hello,
      > I want to get the strings that match c*.txt ( * means asterisk wildcard)
      > from some strings below:
      >
      > c1234.txt
      > 1234.txt
      > a1234.exe
      > cqwer.txt
      > casd.txt
      >
      > I want to use regular or function, do not want to use if....then...
      > How to do?
      >
      > Thank you
      >
      >
      >[/color]


      Comment

      Working...