|
|
|
UEI Nevo Remote Controls Forum - View Post
|
|
|
|
|
|
|
The following page was printed from RemoteCentral.com:
Topic: | RegEx This thread has 4 replies. Displaying all posts. |
|
Post 1 made on Wednesday August 11, 2010 at 05:09 |
Tianree Long Time Member |
Joined: Posts: | April 2010 12 |
|
|
hi all,
don't know if anyone can help me, but I've hit a brick wall with regex, I'm trying to set up a filter in a widget to split long text into multiple lines so trying to get a regex that'll count up letters/spaces to a certain point. has anyone managed to do this? and would you be willing to share the secret?
Cheers
Tian
|
|
Post 2 made on Wednesday August 11, 2010 at 06:55 |
sydinstaller Active Member |
Joined: Posts: | February 2004 740 |
|
|
Hi,
I may be able to help but I will need an example of the text you are trying to cut up.
D.
|
|
OP | Post 3 made on Wednesday August 11, 2010 at 09:05 |
Tianree Long Time Member |
Joined: Posts: | April 2010 12 |
|
|
Cheers, I've sent you a mail with some details
Tian
|
|
Post 4 made on Wednesday August 11, 2010 at 23:04 |
sydinstaller Active Member |
Joined: Posts: | February 2004 740 |
|
|
Hi,
Got your email.
Working on it now. I have a basic version working but I want to improve its reliability.
D.
|
|
Post 5 made on Saturday August 14, 2010 at 08:44 |
sydinstaller Active Member |
Joined: Posts: | February 2004 740 |
|
|
Hi, Sorry for the delay, I have been swamped.
Here is what I came up with.
It is difficult to get this exact without lots of test data but this should work. Using these filters: Filter 1: (?<=SSE0\d{3}).{0,32} Filter 2: (?<=SSE0\d{3}.{32}).{0,32} Filter 3: (?<=SSE0\d{3}.{64}).{0,32} Filter 4: (?<=SSE0\d{3}.{96}).{0,32} Filter 5: (?<=SSE0\d{3}.{128}).{0,32}
I would make each line longer so that you don’t need as many lines of text (filters).
I am assuming (dangerous I know) that the test data has one thing that will always appear in the real data. 1. That after SSE0 there is ALWAYS 3 digits before the shows text.
I cannot guarantee it will always work correctly at the end of the text as each show will have different lengths of data. Only testing will show.
Here is the test data I used: SSE0157Admiral Chegwidden and Clayton Webb make an unlikely team when they join forces to save a CIA agent from Italian terrorists. Starring: Catherine Bell.b3
The other issue is that the "b3" will show in the text as we do not know how long each line will be. If you wanted you could add (?=\.\D\d) to the end of the last filter to remove the "b3" or any other letter/number combo, but this will only work on the last filter, it will not work if the text length is shorter that 5 filters long, as in this example.
D.
|
|
|
Before you can reply to a message... |
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now. |
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.
|
|
|
|