0

I want to match 212*235 as plain text in Slides service Text Range. Hence I used

var trs = text.find('212*234'); var trs = text.find(/212*234/);

also tried with

var re = new RegExp("212*234", "gi"); var trs = text.find(re);

but none of them worked.

https://developers.google.com/apps-script/reference/slides/text-range#findpattern

Is this might be a bug or intentional?

Code Guy
  • 3,059
  • 2
  • 30
  • 74

1 Answers1

1

You want two backslashes before the *, as in:

var s = SlidesApp.getActivePresentation().getSlides()[0].getShapes()[0];
Logger.log(s.getText().find('212\\*235')[0].asString());
Maurice Codik
  • 598
  • 2
  • 6
  • Is there a way to make case sensitive and case insensitive. Any documentation source for the find function parameters? – Code Guy Dec 07 '17 at 05:13
  • Sorry, dont believe there's a way to make it case insensitive. You can file a feature request [here](https://developers.google.com/apps-script/support#missing_features) – Maurice Codik Dec 11 '17 at 21:00