It is currently September 29th, 2024, 11:15 pm

Why RegExp is only limited to WebParser Plugin?

General topics related to Rainmeter.
abhishek12355
Posts: 1
Joined: October 26th, 2012, 3:00 am

Why RegExp is only limited to WebParser Plugin?

Post by abhishek12355 »

I was trying to display some custom quotes from a local file. Each quote have a fixed format. For example Consider:
<item>
<quote>
some quote here
</quote>
<Description>
description / explaination of the quote
</Description>
</item>

Rainmeter provides a plugin QuotePlugin to extract a quote (given a separator).
However QuotePlugin cannot parse the extracted quote as is desired.

WebParser takes a "URL" to fetch and parse the document. Here we have a string to be parsed and extracted as per requirement.

A separate plugin for regex could have easily done the job.

Basically my question is how can we parse a string without using lua or any other coding?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Why RegExp is only limited to WebParser Plugin?

Post by Kaelri »

You can use WebParser on a local file. :) Example:

Code: Select all

URL=file://C:\Users\YourName\Documents\file.txt
(More information about WebParser here.)

I don't think there are many data types aside from web pages and text files that commonly need parsing. And if there are, Lua's pattern matching is usually enough for most jobs. In any case, the way WebParser allows the use of a "child" measure for each capture is very specific to that plugin, so if regular expressions were made into a more general option, it would take some forethought. Like I said, I'm not sure there's much of a demand for this, but we're open to suggestions.