# Regular expression help

**URL:** <https://forums.powershell.org/t/regular-expression-help/538>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/regular-expression-help/538 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/regular-expression-help/538/1 "2011-12-31T18:30:00Z")

</div>

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,Diane@barmal.id,hi@koi.c,relayed,2.0.0 (success),smtp;250 Queued (0.109 seconds),[mail.i.com](http://mail.i.com) (74.206.170.28),api,smtp,13.22.21.1,74.06.10.2,"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$"`  
>   
> See: http://msdn.microsoft.com/en-us/library/ms972966.aspx

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.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:57pm UTC](https://forums.powershell.org/t/regular-expression-help/538/2 "2024-05-16T20:57:51Z")

</div>


