Support is online

Regular Expression = Remove numbers from field #8158

Open erStaranta opened this topic Monday, 04 April 2016 · 10 replies
Author

Hello,

I have a code like that:
1450XL

I need to have only XL.

The rules I did is this:
Replace
Regular Expression
Find: /[^A-Za-z]+/
Replace: $1

I'm sure that I'm wrong, can you help me please?

Thanks a lot in advance!

Support

Hello,
Since you are looking for replacing numbers, your expression should be Find: /^[0-9 ]+/ and leave the Replace field empty and see if it works.

Kind regards,

Tharuna

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

Author

Thank you very much!

Author

If I have a simbol like this: |

With the regular expression it is removed, how can I exclude it to the regular expression?
I need to have the | in the field, thanks.

Thanks a lot!

Support

Hello,

The pipe-symbol is reserved for multiple values unless you specify another one in your replacement rule settings. You can change the multiple values indicator there. Did you try that?

Kind regards,

RolandD

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

Author

Hello,

just tried, but it's not working...

Do you have a solution, please? Thanks a lot!

Support

Hello,

Show me how you have setup the replacement rule, so I can check it.

Kind regards,

RolandD

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

Author

Sure, you find it in attachment.

With this rule I need to remove letters from a sku that is like that:

500|541a

  • rules.png
Support

Ok, that is clear but what is the result after applying the replacement rule?

Kind regards,

RolandD

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

Author

Follow my previous example, the result after the rule is:

500541

Support

You need to update your regular expression, not a CSVI bug.

Your regular expression says to match everything but 0-9. Apparently you don't want to match the | symbol as well, so you should add that after the 9. That should fix it.

Kind regards,

RolandD

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

Log in to reply to this topic.