Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern for Bold and Italic is not working #75

Closed
MuhammadMattiullah opened this issue Mar 7, 2020 · 3 comments
Closed

Pattern for Bold and Italic is not working #75

MuhammadMattiullah opened this issue Mar 7, 2020 · 3 comments

Comments

@MuhammadMattiullah
Copy link

MuhammadMattiullah commented Mar 7, 2020

Code:
{ pattern: /\*\*([a-zA-Z]+)\*\*/g, style: styles.bold },

Input:
This is the **bold** text

Required Output:
This is the bold text

Please can someone tell me @jrichardlai @fbartho

@ChengBenj
Copy link

@MuhammadMattiullah

add this in your json renderText: (matchingString, matches) => matches[1]

works to me

@socialcode-rob1
Copy link

Depending on your pattern, it could be a different element in the array

{
   pattern: /(\*\*|__)(.*?)\1/,
   style: styles.bold,
   renderText: (matchingString, matches) => matches[2],
},

@fbartho
Copy link
Contributor

fbartho commented Jun 11, 2020

@MuhammadMattiullah both of the suggestions above would have been what I recommend for you.

I'm going to close this since there are ways to do what you ask, but if it doesn't work, please do comment back, and I'm happy to reopen it.

If you find a bug or have a PR, I'm working on a new release in #79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants