How to limit seach area to articles' titles only?

Search
Other Pre-Sale questions
Forum

How to limit seach area to articles' titles only?

Sandro's Avatar Sandro
Hello,
is it possible to apply the replacement (regex) only on titles? I tried on the free version and it seems to work either on all the elements of the articles or the body only.
I read that on the pro version there's the tag selection, does this work on the content of the tagged elements or just the tag itself?
Peter van Westen's Avatar Peter van Westen ADMIN
With the Pro version you can set up the replacements to only be done within certain parts of the page, like between certain html elements.
You can also add conditions to make the replacements only be done on the pages or situations you want.
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
I bought the pro version but I'm confused.

I have something like this
<h1 replacethis>this is the title</h1>

How do I replace the content this is the title only when the tag is "h1" with the attribute "replace"?
Peter van Westen's Avatar Peter van Westen ADMIN
Not quite sure what you actual want to replace and in what cases.
Can the attribute in the h1 tag have more than one value? Should it replace in all cases?
Can you give more examples of what the html code looks like and what you want as a result?
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
Sorry,
I think I made it for confusing that it should have been.

Given this html element
<h1 class="title">this is the title</h1>

I want to apply a replace regex inside the content "this is the title" (not the tag or tag's attributes and values) only to elements that have a class="title".
Peter van Westen's Avatar Peter van Westen ADMIN
Can you give more examples of what the html code looks like and what you want as a result?
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
original
<h1 class="title">this is the title</h1>

I want (example)
<h1 class="title"><span>this</span> <span>is</span> <span>the</span> <span>title</span></h1>
Peter van Westen's Avatar Peter van Westen ADMIN
If the H1 tag is litterally that every time, place:
<h1 class="title">
and
</h1>
in the Search Between fields.

Please read the documentation:
docs4.regularlabs.com/rereplacer
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
What if it changes and the only thing that doesn't is a certain attribute (this was my original question)? ex:
<h1 class="title" replacethis>this is the title</h1>
<h1 class="title2" replacethis>this is the title2</h1>
Peter van Westen's Avatar Peter van Westen ADMIN
So again:
Can you give more examples of what the html code looks like and what you want as a result?

If you only give 1 example, I can't see what parts are dynamic and what is fixed. Please help me understand you.
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
Hello
not sure why we can't get solve this 🙂

You said
If the H1 tag is litterally that every time, place:

And I said "what if it changes BUT a certain attribute?", that specific attribute is "replacethis". The H1 can have multiple content (inside the tag) and I want to search that attribute so that I can replace the content inside the element (not inside the tag).


These are two examples:

#1
<h1 class="title" replacethis>this is the title</h1>

replace it with
<h1 class="title" replacethis>this was replaced</h1>


#2
<h1 class="title2" id="whatever" replacethis>this is the title</h1>

replace it with
<h1 class="title2" id="whatever" replacethis>this was replaced</h1>
Peter van Westen's Avatar Peter van Westen ADMIN
Use Regular Expressions:
(<h1(?: [^>]*)?>\s*)this is the title(\s*</h1>)
Replace with:
\1this was replaced\2
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
"this is the title" (the content of the element) is not fixed, it varies.

#1
<h1 class="title" replacethis>this is the title</h1>
<h1 class="title" replacethis>this was replaced</h1>

#2
<h1 class="title2" id="whatever" replacethis>another title is there</h1>
<h1 class="title2" id="whatever" replacethis>this was replaced</h1>

#3
<span class="content" replacethis>another span is there</span>
<span class="content" replacethis>this was replaced</span>


I thought with the pro version I could do this
1) search for any element with a "replacethis" attribute in the tag (or anything else, even a class)
2) get the content of the element
3) apply a custom reg exp of content of the element

That's how I interpreted the "tag selection" feature in the search area.
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry, it is still completely unclear to me what you want to achieve.

In some of the replies/examples you are referencing 'replacethis' but keeping it in both the before and after situation. So I have no idea what you want with that.

Maybe you should give real-world examples, instead of making up some examples.
Please make clear what is fixed and what is dynamic, what part you want to replace with what, what parts are required and what is optional...
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
I got it! It's the "replacethis" that it's confusing you. That is just a selector! Is this clearer?

#1
<h1 class="title" selector>this is the title</h1>
<h1 class="title" selector>this was replaced</h1>

#2
<h1 class="title2" id="whatever" selector>another title is there</h1>
<h1 class="title2" id="whatever" selector>this was replaced</h1>

#3
<span class="content" selector>another span is there</span>
<span class="content" selector>this was replaced</span>
Peter van Westen's Avatar Peter van Westen ADMIN
Then again, it is not clear what you are actually looking for. What do you want to replace with what?
There is nothing common between:
<h1 class="title" selector>this is the title</h1>
and:
<span class="content" selector>another span is there</span>
except the 'selector' part.

So based on those example, do you want to replace ALL the text inside any html tag that has a specific attribute?

Again... not the first time...
give real-world examples
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
Those are real-word examples. What I wanna replace it with it's not important here since it's a just an regex expression. What is important is selecting a specific element with the plugin.

And YES that's exactly what I wanna do. Replace ALL the text inside any html tag that has a specific attribute (or a specific class, id or whatever that can act as an element sector). It's what I've been saying since my second post.
Peter van Westen's Avatar Peter van Westen ADMIN
Use Regular Expressions:
(<([a-z]+[a-z0-9]*)(?: [^>]*)?selector[^>]*>\s*).*?(\s*</\2>)
Replace with:
\1YOUR REPLACEMENT TEXT\3
Please post a rating at the Joomla! Extensions Directory
Reinhold Pescoller's Avatar Reinhold Pescoller
OK, so the pro version was not needed for the search area feature? This is just a regex expression applied to the entire content.
Peter van Westen's Avatar Peter van Westen ADMIN
As it turns out (which wasn't clear from the start), yes, you could have been able to do this with the free version, if you would know how to do it.
But you didn't and needed support.
There is no form of support on the Free version.
You have been asking for a bunch of support to get answers to your questions.
So yes, you needed a subscription.
Please post a rating at the Joomla! Extensions Directory
You can only post on this forum if you log in