Support is online

replacement with regexp #7486

Open OPERCON opened this topic Wednesday, 22 July 2015 · 6 replies
Author

Good day!
I need to replace numeric value of one filed in export template to string value.
So i created replacement, where i find standalone number 7 and replace it with my string.
Find: ([^0-9]7[^0-9]).
But nothing replaces. File is attached. Replacement is applied to 8 column.
Regexp was done and checked with http://regexr.com/ tool.
Maybe there should be added something to make my regexp workable in this replacement?

Support

Hello,

The Find is incorrect, it should look like this

/([^0-9]7[^0-9])/

Notice the /-symbols are added. Give that a try.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

No, it didn't help.
I changed tactics.
If i want to find (^7$) i should find /^7/$/ ? or /^7$/ ?
None of them work, i just can't understand why not.
Because if i take this file, and make regexp for 8 column as (^7$) - (start string SEVEN end string) it works, but it's strange to work with each file manually, if there's a chance to make replacement when exporing(

Support

No, it didn't help.

The question is then what is wrong with the regex perhaps. When I check your regex at http://regexr.com/ it doesn't do what you are trying to achieve.

Because if i take this file, and make regexp for 8 column as (^7$) - (start string SEVEN end string) it works, but it's strange to work with each file manually,

Sorry, but I don't understand what you mean here.

Replacement is applied to 8 column.

If you apply the replacement rule to 1 field first and see if it works.

A simple test is to do the regex /(.*)/ which matches everything, just to see if the rule is triggered.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Don't understand? ok.
We have numbers in 8 column, which we need to replace.
7- should change standalone 7 not 77, not 17, not 75, only standalone 7.
19 should change standalone 19, not 190, not 219.

So, i've made regexp ^7$ (^ - string begginning, 7 - is seven, $ - end of the string).
It works, when make replace in file manually with the tool, that can apply regexp to a column, but doesn't work in csvipro.

Support

It works, when make replace in file manually with the tool, that can apply regexp to a column, but doesn't work in csvipro.

I would think that

^7$

works, so I gave it a try and it works for me.

I don't know how you have setup the replacement rule but something must be wrong. Attached is an image of how I setup the rule. After that it must be assigned to the field you want the rule to be applied to. That is a step that should not be forgotten. If you can't make it work, post screenshots of everything you have setup. This way I can see what you have done.

  • regex_rule.png

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Thanx.

Log in to reply to this topic.