1

I'm unable to use preg_match_all() in Globiflow (for Podio) due to their insistence on preg_match_gf(), which has similar functionality as the regular preg_match(). I have the following code:

preg_match_gf("/<zestimate><amount currency=\"USD\">(.*?)
<\/amount>/ism",*search_result_below*, 1)

and I have it searching the following information for some random property (that I've greatly simplified):

<comparables>
 <comp score="5.0">
  <zpid>########</zpid>
   <zestimate>
    <amount currency="USD">832447</amount>
   </zestimate>
  </comp>
 <comp score="11.0">
  <zpid>########</zpid>
   <zestimate>
    <amount currency="USD">526855</amount>
   </zestimate>
  </comp>
 <comp score="2.0">
  <zpid>########</zpid>
   <zestimate>
    <amount currency="USD">709637</amount>
   </zestimate>
  </comp>
 <comp score="6.0">
  <zpid>########</zpid>
   <zestimate>
    <amount currency="USD">607666</amount>
   </zestimate>
  </comp>
 <comp score="8.0">
  <zpid>########</zpid>
   <zestimate>
    <amount currency="USD">631700</amount>
   </zestimate>
  </comp>
</comparables>

I want to be able to select each instance of the <amount currency="USD"> for each property, as they're going to fill their own fields via their own calculations. The <comp score="#.0"> changes with each query, as do the line positions. I'm unable to use print or echo, as Globiflow considers them illegal operators.

Josh D.
  • 15
  • 4

3 Answers3

4

You can also use preg_match_all_gf to get each amount, eg:

preg_match_all_gf('/<amount currency="USD">(.*?)<\/amount>/ism', [xml-token],1)
preg_match_all_gf('/<amount currency="USD">(.*?)<\/amount>/ism', [xml-token],2)
preg_match_all_gf('/<amount currency="USD">(.*?)<\/amount>/ism', [xml-token],3)

etc

3

Globiflow offers some support documentation for regex and parsing text from Podio, which you may have seen. There are also some useful tools linked there for building / testing regular expressions that could be helpful. Another tool can be found here.

Regarding the lack of support or potential alternatives to preg_match_all in Globiflow, you might try reaching out to their tech support directly. Though assistance with building regex expressions is out-of-scope for them, they should be able to tell you if there is a supported means for matching a regular expression globally.

2

I would like to add some feedback here for you, Josh.

There are a limited amount of functions that work with Globiflow when using PHP calculations. Globiflow has its own Help Manual that contains some very useful links which can help you resolve your calculation issue.

"Using PHP Calculations" gives you a list of all PHP functions that can be used when creating calculations, "PHP Calculation & Regex Examples" displays some "real life" examples used by other Globiflow members and "Parsing Text in Podio with Globiflow" takes you even further into the information you seek with a complete explanation to how you return what is found within the preg_match_gf function.

For reference, here are the links to the documentation

globiflow.com/help/

globiflow.com/help/using-php-calculations.php

globiflow.com/help/php-calculation-examples.php

globiflow.com/blog/parsing-text-in-podio-with-globiflow.php

domokun
  • 3,013
  • 3
  • 29
  • 55