# 【質問内容】テキストをbb codeを抜いた形で表示する時、\[~~~\]を抜いて表示出来るようにしたい......

**URL:** <https://www.nocode-faq.com/t/topic/655>\
**Category:** bubble\
**Created:** [2021 年 2 月 2 日午前 10:33 UTC](https://www.nocode-faq.com/t/topic/655 "2021-02-02T10:33:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Question\_user](https://avatars.discourse-cdn.com/v4/letter/q/53a042/32.png) [@Question\_user](https://www.nocode-faq.com/u/Question_user)\
**Post date:** [2021 年 2 月 2 日午前 10:33 UTC](https://www.nocode-faq.com/t/topic/655/1 "2021-02-02T10:33:48Z")

</div>

【質問内容】テキストをbb codeを抜いた形で表示する時、[~~~]を抜いて表示出来るようにしたい  
■状況  
rich text input(プラグイン?)で入れた時、BB codeを活かした入力が出来るようになっています。  
ただ、その文を見出し的に表示する際、bb codeはオフにし、[~~~]を表示したい次第です。  
■解決に必要そうな判断事項  
・[~~~]の中身は大幅に変わります。  
[img src], [url], [b]…など様々あり。  
■参考画像  
このようになってしまいます。テキストのみにしたい。

---

<div class="post-metadata">

**Author:** ![Answer\_user](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@Answer\_user](https://www.nocode-faq.com/u/Answer_user)\
**Post date:** [2021 年 2 月 2 日午前 10:33 UTC](https://www.nocode-faq.com/t/topic/655/2 "2021-02-02T10:33:49Z")

</div>

回答者１  
見出し的に表示するとはもう少しどういった状況か教えて欲しいです！

質問者  
言葉足らずで恐縮です、noteの記事一覧が近いので共有します！(スクショ オレンジ部分)  
文章の一部を持ってきた時に、htmlの情報は入っていないかと思うのですが、このようにシンプルなテキストのみにしたい次第です\>\<

回答者１  
あ〜なるほどです！  
即答できないです！少し触って見ます〜！

回答者１

> **[How can I get text ignored to HTML tags?](https://forum.bubble.io/t/how-can-i-get-text-ignored-to-html-tags/80614/2)**
>
> Selam Efe! Sorry for the obvious answer, but the best would be to exclude the HTML tags from the source text 🙂 However if that’s not possible, maybe to try to use the :find&replace command with a RegEx pattern to replace all the html tags with...

これ試してみてます。なう。  
正規表現の書き方がよくわからず。  
find replaceで [\*] では判定してくれないみたい

質問者  
ありがとうございます\>\<  
来週くらいまでに解決したいな、ってスピード感なので、見えてきたらぜひ教えてください\>\<  
お手数おかけします…!!

回答者２  
[https://nocodecamp.slack.com/archives/C011VKGRWLU/p1599228570078300?thread\_ts=1599224826.077500&cid=C011VKGRWLU](https://nocodecamp.slack.com/archives/C011VKGRWLU/p1599228570078300?thread_ts=1599224826.077500&cid=C011VKGRWLU)  
からの続きで、[._?] でも動きます。「._」で大文字・小文字、数字関係なく[]内に存在する全ての文字列を対象にして消します。「?」は「直前の文字が0個または１個以上の場合一致」になるので複数その文字列がある場合、それぞれ1つずつで一致するのを区切ります。  
「[Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript](https://regex101.com/%E3%80%8D%E3%81%A7%E3%81%A9%E3%81%AE%E6%96%87%E5%AD%97%E5%88%97%E3%81%8C%E5%BC%95%E3%81%A3%E3%81%8B%E3%81%8B%E3%82%8B%E3%81%AE%E3%81%8B%E3%82%92%E6%A4%9C%E8%A8%BC%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%99%E3%80%82)  
「[https://qiita.com/keitassssm/items/d498c7f1c9819c7b84d0」も参考になるかな、と！](https://qiita.com/keitassssm/items/d498c7f1c9819c7b84d0%E3%80%8D%E3%82%82%E5%8F%82%E8%80%83%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%8B%E3%81%AA%E3%80%81%E3%81%A8%EF%BC%81)

色がついてるところが正規表現に引っかかってる部分です。ただし注意点として本文に[]が使われている場合、それも消えますw 仮にimgタグだけ消したいのであれば [img.\*?] にすると間違いが少なくなります。

質問者  
なるほど！！！  
(というかシンプルですが、この影響出ている部分のチェックサイト、すごいですね！！！)

## 参考画像

 ![image (99).png](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/1X/bcd3550834b5fab86f0a44c08151dbbda475a89d.png)

 ![image (98).png](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/1X/ab5eab8671afc11f42133af89a7799f209b6dee3.png)

 ![スクリーンショット 2020-09-04 13.32.22.png](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/1X/545f12e7a5ac1a610225be829c8773466bfac066.jpeg)

![Screenshot 2020-09-04 at 16.32.47.png](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/1X/2960fdfbba40e7e43697ce680cdf2fdf359cc251.png)

 ![Screenshot 2020-09-04 at 16.40.53.png](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/1X/2bf28a9540be2289659d26d8ffff30f035b83cec.png)

## 参考URL

> **[How can I get text ignored to HTML tags?](https://forum.bubble.io/t/how-can-i-get-text-ignored-to-html-tags/80614/2)**
>
> Selam Efe! Sorry for the obvious answer, but the best would be to exclude the HTML tags from the source text 🙂 However if that’s not possible, maybe to try to use the :find&replace command with a RegEx pattern to replace all the html tags with...

[https://nocodecamp.slack.com/archives/C011VKGRWLU/p1599228570078300?thread\_ts=1599224826.077500&cid=C011VKGRWLU](https://nocodecamp.slack.com/archives/C011VKGRWLU/p1599228570078300?thread_ts=1599224826.077500&cid=C011VKGRWLU)

> **[Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript](https://regex101.com/)**
>
> Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.

> **[正規表現についてまとめ - Qiita](https://qiita.com/keitassssm/items/d498c7f1c9819c7b84d0)**
>
> 正規表現とは
> 
> 特殊な文字を組み合わせてパターンを作ることで、ある文字列に特定の文字が含まれているかを確認することや、特定の文字を取り除くなどの操作を行うことができます。
> 
> 
> 正規表現の記号と意味
> 
> 
> 
> 
> 記号
> 記号の説明
> 例 ...
