Regular expression help

Welcome Forums General PowerShell Q&A Regular expression help

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #5483

    Points: 0
    Rank: Member

    by wolfeyes333 at 2013-01-29 11:30:35

    I'm trying to match the last number the string below which has to be equal to 1, can you please guide me how I can go about doing this. I want to search through logs and extract all the lines that end in the number 1 at the end of the string.

    acct-b-2013-01-29-0053.csv:d,2013-01-29 11:54:38-0500,2013-01-29 11:54:38-0500,,,hi@koi.c,,relayed,2.0.0 (success),smtp;250 Queued (0.109 seconds), (,,api,,smtp,,,"SIZE,AUTH,AUTH:LOGIN",6709,bal3038,1,1

    by ArtB0514 at 2013-01-29 11:35:27

    Match a string that ends in the numeral 1:
    $String -match "1$"


    by wolfeyes333 at 2013-01-29 11:40:52

    Thanks for the response, if the match the string that ends in 1 then it may include string where the number after the last comma is for example 341 which is not what I want to include. I would want the string to match if the number after the last column is equal to 1. I'll check the link that you provided.

    by DonJ at 2013-01-29 12:03:51

    Then make it ",1$"

    by wolfeyes333 at 2013-01-29 12:11:12

    Thanks, I'll try that. You saved me a lot of time.

The topic ‘Regular expression help’ is closed to new replies.