Title: XPath filtering expression
Last modified: October 16, 2021

---

# XPath filtering expression

 *  Resolved [Derezomov](https://wordpress.org/support/users/alex-mi/)
 * (@alex-mi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/xpath-filtering-expression/)
 * I have an XML that has a price field with values of, for example, “10 USD”, and
   I can’t filter with XPath to get only products with the rule “equals or greater
   than” because the field should contain only numbers for the filtering to work.
 * Is there a way to remove everything except or the numerical characters? I have
   tried with str_replace and preg_replace, but maybe I can’t find the correct expression
   for this?
 * Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [WP All Import](https://wordpress.org/support/users/wpallimport/)
 * (@wpallimport)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/xpath-filtering-expression/#post-14999685)
 * Hi [@alex-mi](https://wordpress.org/support/users/alex-mi/),
 * > Is there a way to remove everything except or the numerical characters? I have
   > tried with str_replace and preg_replace, but maybe I can’t find the correct
   > expression for this?
 * Yes, you can use the XPath 1.0 function “translate” for this: [https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/translate](https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/translate).
   So, for example, your XPath might end up looking like this:
 * `/post[translate(price[1]," USD","") >= 10]`
 *  Thread Starter [Derezomov](https://wordpress.org/support/users/alex-mi/)
 * (@alex-mi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/xpath-filtering-expression/#post-15001020)
 * Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘XPath filtering expression’ is closed to new replies.

 * ![](https://ps.w.org/wp-all-import/assets/icon-256x256.png?rev=2570179)
 * [WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets](https://wordpress.org/plugins/wp-all-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-all-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-all-import/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-all-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-all-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-all-import/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Derezomov](https://wordpress.org/support/users/alex-mi/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/xpath-filtering-expression/#post-15001020)
 * Status: resolved