Skip to content

Commit

Permalink
regex more flexible for openai output
Browse files Browse the repository at this point in the history
  • Loading branch information
Trismegiste committed Mar 8, 2024
1 parent d450b2e commit 9560a22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions templates/fragment/form_minitoolbar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
let wikitext = []
// title
const titleRegex = /^\*\*([^\*]+)\s:\*\*/g
const titleRegex = /^\*\*([^\*]+)\s:\*\*\n\n/gm
const title = titleRegex.exec(selection)
if (null !== title) {
wikitext.push(`==${title[1]}==`)
}
// paragraph
const regex = /^.+\*\*([^\*]+)\s:\*\*\n\s+(.+)$/gm
const regex = /^.*\*\*([^\*]+)\s:\*\*\n\s+([^\n]+)\n\n/gm
let m = null
while ((m = regex.exec(selection)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
Expand Down

0 comments on commit 9560a22

Please sign in to comment.