---
title: "Using %string% instead of {{string}} in a RegEx"  
description: "Using %string% instead of {{string}} in a RegEx"  
author: "Anonymous User"  
published: 2013-09-28  
updated: 2013-09-28  
canonical: https://www.mindstick.com/forum/1553/using-string-instead-of-string-in-a-regex  
category: "html5"  
tags: ["html5"]  
reading_time: 1 minute  

---

# Using %string% instead of {{string}} in a RegEx

To [translate](https://www.mindstick.com/interview/1732/how-to-translate-in-android) some [strings](https://www.mindstick.com/forum/161912/explain-the-python-strings) in my [HTML](https://www.mindstick.com/articles/1530/design-a-simple-stylish-calculator-using-html-css-and-javascript), I'm using the following [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) which is working totally fine to [replace](https://yourviews.mindstick.com/view/81330/cow-antibody-research-in-usa-a-step-ahead-to-replace-plasma-therapy) every [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) coming in double [curly braces](https://answers.mindstick.com/qa/31876/when-we-use-curly-braces-in-the-string-format-its-not-working-in-c-sharp):

```
var translation = html.replace(/\{[^\}]*\}/g, function(match){
    // where the magic happens
});
```

\
How can I change the [RegEx](https://www.mindstick.com/forum/160352/how-to-use-regex-in-javascript-for-pattern-matching) to [match](https://www.mindstick.com/forum/159713/regex-match-attribute-in-an-html-code) the [pattern](https://www.mindstick.com/forum/2314/what-is-the-mvp-and-mvc-pattern) %string% instead of {{string}}?

## Replies

### Reply by Anonymous User

Hi John!

Your current pattern actually doesn't match double curly braces, it matches only single curly braces, but anyway if you want to match %string% then you can use:

```
/%[^%]*%/g
```


---

Original Source: https://www.mindstick.com/forum/1553/using-string-instead-of-string-in-a-regex

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
