Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

RegExp - Regular Expressions

Discuss anything to do with plugins

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
johnmacd
Posts: 26
Joined: March 6th, 2006, 3:08 am

RegExp - Regular Expressions

Post by johnmacd »

This is the first time I've ever heard of reg exp. I've been playing with your examples and sort of understand how some of them work. But I need a little help. I have also looked thru http://www.regular-expressions.info/ but I cant seem to figure out if I can get this to work using this plugin.

Let's say I have the following in test.txt
<property name="tv.rec.now1.title">Stargate SG-1</property>
<property name="tv.rec.now2.title" />

I would like it to display:
Stargate SG-1
None

I have the following lines in LCD Smartie:
$dll(regexp.dll,1,[I'm not sure what goes here],$File(C:\test.txt,1))
$dll(regexp.dll,1,[I'm not sure what goes here],$File(C:\test.txt,2))


I want to display everything between the > and the second <
if there is nothing after the > then I want the word None displayed.

Is this even possible?
Thanks
johnmacd
Posts: 26
Joined: March 6th, 2006, 3:08 am

Post by johnmacd »

I've been able to figure out part of this.

using the following in LCD Smartie:
$dll(regexp.dll,1,>(.*)<,$File(C:\tunerview.xml,1))

I get:
>Stargate SG-1<

How can I get rid of the > and < from displaying on the screen?

Also how can I get the word NONE to display from the following line:
<property name="tv.rec.now2.title" />

I want to replace the blank space between " and / with the word NONE

basically I am looking to have it display anything between " and /
and remove any > or <
and if there is nothing between " and / have it display NONE

Can anyone help?
jonny
Posts: 48
Joined: December 18th, 2005, 5:50 am

Post by jonny »

i'm sure you can do this with regular expressions, but they confuse me so I cant help you with that. However, an easy fix is to use Limbo's "search and replace" plugin, and have "<" and ">" be the search term, and leave the replace sting blank.

I have dont this before and it works great.
johnmacd
Posts: 26
Joined: March 6th, 2006, 3:08 am

Post by johnmacd »

Thanks, but I tried using the search and replace plugin, but I keep getting an access violation in mscorlib.ni.dll if there is blank in there.
jonny
Posts: 48
Joined: December 18th, 2005, 5:50 am

Post by jonny »

huh, that's funny. I have never had that problem. Oh well, it was worth a try!
erlis
Plugin Author
Posts: 37
Joined: March 30th, 2006, 1:50 pm
Contact:

Post by erlis »

This seem to work:

Code: Select all

$dll(regexp.dll,3,.*>(.*)<.*#\1#.*/>#None,<property name="tv.rec.now2.title" /> )
Will output: "None"

Code: Select all

$dll(regexp.dll,3,.*>(.*)<.*#\1#.*/>#None,<Property name="tv.rec.now1.title">Stargate SG-1</property> )
Will output: "Stargate SG-1"

Code: Select all

$dll(regexp.dll,3,.*>(.*)<.*#\1#.*/>#None,$File(C:\test.txt,1))
$dll(regexp.dll,3,.*>(.*)<.*#\1#.*/>#None,$File(C:\test.txt,2))
Post Reply