One Match Group, but several matches - How to merge matches?

Hi RegEx-Experts!

I've the following text:

1 15.09.2015 Anfahrt (Km inkl. Reisezeit)
T20150915.0017 | RFC:: Umbau Serverraum
Seriennummer(n):
Ticket-Warenposten 39,40 0,90 35,46
2 25.09.2015 APC Smart-UPS 1500VA LCD RM 2U 230V
T20150915.0012 | USV hat gestern gepiept
Seriennummer(n):
APC Smart-UPS 1500VA LCD RM 2U 230V
SN: SAS1518113014
Ticket-Warenposten 1,00 595,00 595,00
3 25.09.2015 APC UPS Network Management Card 2
T20150915.0012 | USV hat gestern gepiept

Open in new window


My RegEx:

([T][\d]{8}\.[\d]{4})

Open in new window


My output:

Match 1
1.      T20150915.0017
Match 2
1.      T20150915.0012
Match 3
1.      T20150915.0012


I got an output of THREE matches. How can i merge that THREE into one?


The following output would be my one ...

T20150915.0017,T20150915.0012,T20150915.0012

Any Idea?

Best regards, Kai
LVL 1
kv0sAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I don't understand what you mean by merge...

Are you asking how to modify the regular expression to merge the search into one match?  Or, do you want to concatenate the results together into a single string?
0
kv0sAuthor Commented:
Hello Bob.

Yes, i will concatenate the results.

The result should be:

"T20151002.0001, T20141002.0005"

and not

Two single matches:
Match 1: T20151002.0001
Match 2: T20151002.0002
0
Bob LearnedCommented:
Given that you want to concatenate the results, I would need to know more about what you are working with:

1) Design platform

2) Execute platform

3) Regex engine
0
Derek JensenCommented:
Put simply, Regex is a pattern matching language, and does not support higher-level language constructs like loops and concatenations (although some flavors have rudimentary "if" support).

If your regex returns three matches, the only way (that I know of) to merge the matches into a single text string is to do it outside of the Regex itself. :-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.

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.