Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex ! " " & @ # " ^. 我将在代码中包含这些内容。@Ana您不需要将它们全部转义。只有正则表达式的特殊字符,它们应该已经在我的代码中列出了。嗨,MT0,我正在一个有45k个单词和句子的表上运行这段代码。它已经运行了15个多小时,而且还在运行。你认_Regex_Oracle_Replace_Pattern Matching_Regexp Replace - Fatal编程技术网

Regex ! " " & @ # " ^. 我将在代码中包含这些内容。@Ana您不需要将它们全部转义。只有正则表达式的特殊字符,它们应该已经在我的代码中列出了。嗨,MT0,我正在一个有45k个单词和句子的表上运行这段代码。它已经运行了15个多小时,而且还在运行。你认

Regex ! " " & @ # " ^. 我将在代码中包含这些内容。@Ana您不需要将它们全部转义。只有正则表达式的特殊字符,它们应该已经在我的代码中列出了。嗨,MT0,我正在一个有45k个单词和句子的表上运行这段代码。它已经运行了15个多小时,而且还在运行。你认,regex,oracle,replace,pattern-matching,regexp-replace,Regex,Oracle,Replace,Pattern Matching,Regexp Replace,! " " & @ # " ^. 我将在代码中包含这些内容。@Ana您不需要将它们全部转义。只有正则表达式的特殊字符,它们应该已经在我的代码中列出了。嗨,MT0,我正在一个有45k个单词和句子的表上运行这段代码。它已经运行了15个多小时,而且还在运行。你认为我们必须修改代码来提高性能吗?或者有没有办法确定在任何给定时间更新了多少行? Create table temp( id NUMBER, word VARCHAR2(1000), Sentence VARCHA


! " " & @ # " ^. 我将在代码中包含这些内容。@Ana您不需要将它们全部转义。只有正则表达式的特殊字符,它们应该已经在我的代码中列出了。嗨,MT0,我正在一个有45k个单词和句子的表上运行这段代码。它已经运行了15个多小时,而且还在运行。你认为我们必须修改代码来提高性能吗?或者有没有办法确定在任何给定时间更新了多少行?
Create table temp(
  id       NUMBER,
  word     VARCHAR2(1000),
  Sentence VARCHAR2(2000)
);

insert into temp
SELECT 1,'automation testing', 'automtestingation testing is popular kind of testing' FROM DUAL UNION ALL
SELECT 2,'testing','manual testing' FROM DUAL UNION ALL
SELECT 3,'manual testing','this is an old method of testing' FROM DUAL UNION ALL
SELECT 5,'B-number analysis','B-number analysis table' FROM DUAL UNION ALL
SELECT 6,'B-number analysis table','testing B-number analysis' FROM DUAL;

MERGE INTO temp dst
USING (
  WITH ordered_words ( rn, id, word ) AS (
    SELECT ROW_NUMBER() OVER ( ORDER BY LENGTH( word ) ASC, word DESC ),
           id,
           word
    FROM   temp
  ),
  sentences ( rid, sentence, rn ) AS (
    SELECT ROWID,
           sentence,
           COUNT(*) OVER () + 1
    FROM temp
  UNION ALL
    SELECT s.rid,
           REGEXP_REPLACE(
             REGEXP_REPLACE(
               s.sentence,
               '(^|[^a-z])' || w.word || '($|[^a-z])',
               '\1' || 'http://localhost/'|| w.id ||'/<u>'||w.word ||'<u>' || '\2',
               1,
               0,
               'i'
              ),
             '(^|[^a-z])' || w.word || '($|[^a-z])',
             '\1' || w.word || '\2',
               1,
               0,
               'i'
              ),
           s.rn - 1
    FROM   sentences s
           INNER JOIN ordered_words w
           ON ( s.rn - 1 = w.rn ) 
  )
  SELECT rid, sentence
  FROM   sentences
  WHERE  rn = 1
) src
ON ( dst.ROWID = src.RID )
WHEN MATCHED THEN
  UPDATE
  SET    sentence = src.sentence;
ID   WORD                SENTENCE
1   automation testing  automtestingation http://localhost/2/<u>testing<u> 
                        is popular kind of http://localhost/2/<u>testing<u>
2   testing             http://localhost/3/<u>manual 
                        http://localhost/2/<u>testing<u><u>
3   manual testing      this is an old method of 
                        http://localhost/2/<u>testing<u>
5   B-number analysis   http://localhost/6/<u>http://localhost/5/<u>B- 
                        number analysis<u> table<u>
6   B-number analysis table http://localhost/2/<u>testing<u> 
                        http://localhost/5/<u>B-number analysis<u>
ID | WORD | SENTENCE -: | :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 | automation testing | automtestingation http://localhost/2/<u>testing</u> is popular kind of http://localhost/2/<u>testing</u> 2 | testing | http://localhost/3/<u>manual testing</u> 3 | manual testing | this is an old method of http://localhost/2/<u>testing</u> 4 | punctuation | http://localhost/1/<u>automation testing</u>,http://localhost/3/<u>manual testing</u>,http://localhost/4/<u>punctuation</u>,automanual http://localhost/2/<u>testing</u>-http://localhost/2/<u>testing</u> 5 | B-number analysis | http://localhost/6/<u>B-number analysis table</u> 6 | B-number analysis table | http://localhost/2/<u>testing</u> http://localhost/5/<u>B-number analysis</u> 7 | Not Matched | http://localhost/2/<u>testing</u> http://localhost/2/<u>testing</u> http://localhost/2/<u>testing</u> ID | WORD | SENTENCE -: | :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 | automation testing | automtestingation http://localhost/2/<u>testing</u> is popular kind of http://localhost/2/<u>testing</u> 2 | testing | http://localhost/3/<u>manual testing</u> 3 | manual testing | this is an old method of http://localhost/2/<u>testing</u> 4 | punctuation | http://localhost/1/<u>automation testing</u>,http://localhost/3/<u>manual testing</u>,http://localhost/4/<u>punctuation</u>,automanual http://localhost/2/<u>testing</u>-http://localhost/2/<u>testing</u> 5 | B-number analysis | http://localhost/6/<u>B-number analysis table</u> 6 | B-number analysis table | http://localhost/2/<u>testing</u> http://localhost/5/<u>B-number analysis</u> 7 | Not Matched | http://localhost/2/<u>testing</u> http://localhost/2/<u>testing</u> http://localhost/2/<u>testing</u> 8 | ^[($ | http://localhost/2/<u>testing</u> characters http://localhost/8/<u>^[($</u> that need escaping in a regular expression