我有一列带有行的字符串。我只需要字符串的特定部分。所有行都有我需要的部分,该部分从相同的字符号开始但在不同的位置结束,因此我无法使用该逻辑来提取它。
例如,这些是此列中四行的单元格,我需要前两行分别为STRUCTURAL_PASSED和后两行为DW_MERGE_PROCESSING的部分。
如果我可以为这些行中的每一行提取字符串的那部分,并使用理想的提取物制作一个新行。
{"SEQUENCE_NUMBR":55641,"STATUS_OF_FILE_SYSTM":"STRUCTURAL_PASSED","REPORTING_SCHEDULE_NAME":"SPRING_2019"}
{"SEQUENCE_NUMBR":55641,"STATUS_OF_FILE_SYSTM":"STRUCTURAL_PASSED","REPORTING_SCHEDULE_NAME":"SPRING_2019"}
{"SEQUENCE_NUMBR":55641,"STATUS_OF_FILE_SYSTM"::"DW_MERGE_PROCESSING","REPORTING_SCHEDULE_NAME":"SPRING_2019"}
{"SEQUENCE_NUMBR":55641,"STATUS_OF_FILE_SYSTM":"DW_MERGE_PROCESSING","REPORTING_SCHEDULE_NAME":"SPRING_2019"}
答案 0 :(得分:1)
您希望子字符串从位置49开始,直到排除双引号为止。
您可以结合使用let stateShapeExample = {
module: {
items: {
firstItemId: {...},
secondItemId: {...},
...
}
}
}
const selectModuleRoot = (state) => state.module;
// First Option: starts from the module root
const selectModuleItemById = (state, id) => state.items[id];
// Second Option: starts from the global root
const selectModuleItemById = (state, id) => state.module.items[id];
// Something Else: ???
const selectItemById = (state, id) => state[id];
和SUBSTR
:
INSTR
或者您可以使用substr(substr(text, 49, 4000), 1, instr(substr(text, 49, 4000), '"') - 1)
:
REGEXP_SUBSTR
演示:https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=ac1a2e8bf3b7a55c6eeede6078e50bdd