0

I have an asp variable [@@Price] that displays with extra content - $12.69/CS I'm having problems inserting the cleaned [@@Price] variable into meta field -specifically content="".

I have the refex working. I use it on some google import functions

=REGEXEXTRACT("//*[@id='Price']/a"),"\d+\.\d{1,2}")

This will do as I need taking $12.69/CS and show only 12.69

What I can't seem to do is include this correctly in the HTML I need and am looking for direction and best way.

The goal is

<meta itemprop="price" content="12.69" />

Attempted already was trying to insert simple<javascript></javascript> inside the content="" Embedding JS

<meta itemprop="price3" class="pricecleaned" content="javascript:regexreplace([@@Price]:\d+\.\d{1,2}, "")" />

Also attempted was setting dom elements in javascript with no success. Everything I attempt seems terribly inefficient and like I'm missing the obvious.

Note: The page is complicated with many variables, JavaScript, a document ready set of JavaScript

Unfortunately I can not share the internal page or link.

The goal again is [@@Price] renders in html as $12.69/CS ( this could be all sorts of /TR, /RI etc)

Results needed is the regex cleaned variable in the content="" Precisely -

<meta itemprop="price" content="12.69" />

The Regex Works, I just need help how to put into the CONTENT="" so I get the end result.

Not a real meerkat
  • 5,604
  • 1
  • 24
  • 55
userJ
  • 7
  • 4

1 Answers1

0

This RegEx might help you to divide your prices into two groups where using $1 you can simply replace undesired $ and any other non-numeric chars afterwards:

^\$([0-9\.\,]+).+$

enter image description here

If you wish to replace your string, this post explains that how a string can be replaced using RegEx.

Emma
  • 27,428
  • 11
  • 44
  • 69
  • 1
    Thank you - As I mentioned the Regex I have works - \d+\.\d{1,2} - does the same thing and has been proven. What I can't seem to figure out is the statement to insert that regex into the meta content="" spot. content="javascript:regextract([@@Price]:\d+\.\d{1,2}" etc. < This line - and how to put the variable, the regex INTO the content="" quotes. – userJ Apr 19 '19 at 19:04