JDownloader Community - Appwork GmbH
 

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 28.02.2016, 02:51
Kino Kino is offline
Fibre Channel User
 
Join Date: Nov 2010
Posts: 116
Default Regex string separation help. (or splitting strings in to pieces)

Hi friends,

Suppose this is my packagename string.
text1-text2

I use (.*)-(.*) as regex rule to split this string.
Result:
<jd:orgpackagename:1> = text1
<jd:orgpackagename:2> = text2


That's good.

But if my packagename has two of "-" character like
text1-text2-text3

then result is:
<jd:orgpackagename:1> = text1-text2
<jd:orgpackagename:2> = text3


if my expectation is using first "-" character as separation point, how regex rule should I use?
In other words, for second case my expectation is this:
<jd:orgpackagename:1> = text1
<jd:orgpackagename:2> = text2-text3


A sample link to test:
**External links are only visible to Support Staff****External links are only visible to Support Staff**

With current rule, for the test link I get this:
<jd:orgpackagename:1> = Moero Knight-Monkey
<jd:orgpackagename:2> = Happy New Year


But my expectation is this:
<jd:orgpackagename:1> = Moero Knight
<jd:orgpackagename:2> = Monkey-Happy New Year


How should I modify my regex rule?
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 16:42.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.