Regular Expression Question

Results 1 to 2 of 2

Thread: Regular Expression Question

  1. #1
    Join Date
    Dec 1969

    Default Regular Expression Question

    I have a string that has words delinated by commas.<BR>The words can be w* or w*sw* or w*-w*<BR>eg: list, of, words-like, these here, in, this, list<BR><BR>This does not seem to work. Any ideas?<BR><BR>$Tgt=~s/(w*[s+][-+][w+])[,s]/$BEFORE$1$AFTER /g;<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Regular Expression Question

    What does "~s/" do?<BR>It looks to me like you&#039;re looking for:<BR>(any number of word chars<BR>at least one space<BR>at least one hyphen<BR>at least one word char)<BR>followed by a comma or space<BR><BR>so, the following could pass:<BR>" -a ", or " --aa,"<BR><BR>Right?

Posting Permissions

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