Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.

Commit

Permalink
Add clear to extract answer
Browse files Browse the repository at this point in the history
  • Loading branch information
FPT-NMTung committed Aug 18, 2022
1 parent 651e790 commit 10d6612
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quizlet-learn",
"version": "1.0.5",
"version": "1.0.6",
"private": true,
"dependencies": {
"@nextui-org/react": "^1.0.0-beta.9",
Expand Down
18 changes: 9 additions & 9 deletions src/components/LearnPmg/LearnPmg.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ const extractAnswer = (text) => {
const result = text
.split('\n')
.filter((item) => {
return item.slice(0, 5).match(/[AaBbCcDdEeFfGgHh]\. /g);
return item.slice(0, 5).match(/^[AaBbCcDdEeFfGgHh]\. /g);
})
.map((item) => {
let a;
if (item.slice(0, 5).match(/[Aa]{1}\. /g)) a = 'A';
if (item.slice(0, 5).match(/[Bb]{1}\. /g)) a = 'B';
if (item.slice(0, 5).match(/[Cc]{1}\. /g)) a = 'C';
if (item.slice(0, 5).match(/[Dd]{1}\. /g)) a = 'D';
if (item.slice(0, 5).match(/[Ee]{1}\. /g)) a = 'E';
if (item.slice(0, 5).match(/[Ff]{1}\. /g)) a = 'F';
if (item.slice(0, 5).match(/[Gg]{1}\. /g)) a = 'G';
if (item.slice(0, 5).match(/[Hh]{1}\. /g)) a = 'H';
if (item.slice(0, 5).match(/^[Aa]{1}\. /g)) a = 'A';
if (item.slice(0, 5).match(/^[Bb]{1}\. /g)) a = 'B';
if (item.slice(0, 5).match(/^[Cc]{1}\. /g)) a = 'C';
if (item.slice(0, 5).match(/^[Dd]{1}\. /g)) a = 'D';
if (item.slice(0, 5).match(/^[Ee]{1}\. /g)) a = 'E';
if (item.slice(0, 5).match(/^[Ff]{1}\. /g)) a = 'F';
if (item.slice(0, 5).match(/^[Gg]{1}\. /g)) a = 'G';
if (item.slice(0, 5).match(/^[Hh]{1}\. /g)) a = 'H';
return {
key: a,
value: item,
Expand Down

0 comments on commit 10d6612

Please sign in to comment.