What would RE look like for matching just the last character of an input?

Hi, I want to match the last character of a named expression but I'm getting exception error saying Quantifier {x,y} for following nothing.
My RE: *(?<gn>\w)

How can I correct this?  Thank you.
lapuccaAsked:
Who is Participating?
 
ddrudikCommented:
Depends what the last character might be, to include all chars. (except \n unless option-enabled):
(.*)(?<gn>.)

To use your \w:
(\w*)(?<gn>\w)
0
 
ddrudikCommented:
Please provide the source text to match against and what exactly you want to match in that source text.
0
 
sjith2000Commented:
Please be elaborate on your problem.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
lapuccaAuthor Commented:
The source text that got the error is "*G".
I group all the Gs together and named as gn.  Thank you.
0
 
lapuccaAuthor Commented:
The source text ;*' means wildcard just like RE.
0
 
ddrudikCommented:
I don't understand what you are asking for; if you need a regular expression to make some source text I assume you have some source text sample, if not I cannot help.
0
 
lapuccaAuthor Commented:
In my C# application I am asking users to enter limited characters that I then translate into a regular expression and use it to find matches in a Ado.net datatable and use that match result to find another match in another datatabel.  It's kind of complicated but that is the design requirment.
If they enter "*G" then I need to find in the datatabel that matches the last character
For example, abcdef from table 1 would be matched into 12353283082f of the 2nd table.  I just need help in how to translate the wildcard and to only match the last char of a name group in RE.
Would it be something like
(\w)*(?<gn>\w)
Thank you.
0
 
lapuccaAuthor Commented:
Ahh, that would be perfect, (.*)(?<gn>.)
Thank you.
0
 
ddrudikCommented:
Thanks for the question and the points.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.