SQLITE选择带有数字的子字符串

时间:2017-09-08 07:18:07

标签: sql regex sqlite select

DB:SQLITE

我有这样的专栏:

col1
-----------------------
sadGDd asd : 342,45 sdSf
sdlkjk k k30 234.34  ss
sdfkHHkdsf 3422

我需要选择子串

substr(col1)
---------
342,45
234.34
3422

2 个答案:

答案 0 :(得分:0)

你可以使用

pod_nanny.go:56] Invoked by [/pod_nanny --cpu=80m --extra-cpu=0.5m --memory=140Mi --extra-memory=4Mi --threshold=5 --deployment=heapster --container=heapster --poll-period=300000 --estimator=exponential]
pod_nanny.go:68] Watching namespace: kube-system, pod: heapster-2708163903-mqlsq, container: heapster.
pod_nanny.go:69] cpu: 80m, extra_cpu: 0.5m, memory: 140Mi, extra_memory: 4Mi, storage: MISSING, extra_storage: 0Gi
pod_nanny.go:110] Resources: [{Base:{i:{value:80 scale:-3} d:{Dec:<nil>} s:80m Format:DecimalSI} ExtraPerNode:{i:{value:5 scale:-4} d:{Dec:<nil>} s: Format:DecimalSI} Name:cpu} {Base:{i:{value:146800640 scale:0} d:{Dec:<nil>} s:140Mi Format:BinarySI} ExtraPerNode:{i:{value:4194304 scale:0} d:{Dec:<nil>} s:4Mi Format:BinarySI} Name:memory}]

请参阅regex101 demo

答案 1 :(得分:0)

Aleks得到了很好的答案,但他的正则表达式匹配表达式如123.456,789.1011,1516.1718

我认为最好使用:

 public class RequestConsumer :
    IConsumer<StartFlowCommand>,
    IConsumer<List<StartAndNextCommand>>
{
    readonly IWorkFlowHandler _flowHandler;
    public RequestConsumer(IContainer container)
    {
        _flowHandler = container.Resolve<IWorkFlowHandler>();
    }

    public async Task Consume(ConsumeContext<StartAndNextCommand> context)
    {
        var result =await  _flowHandler.WorkFlowStartNext(context.Message);
        await context.RespondAsync(result);
    }


    public async Task Consume(ConsumeContext<List<StartAndNextCommand>> context)
    {
        var result = await Task.Run(() => _flowHandler.WorkFlowStartNextBatch(context.Message));
        await context.RespondAsync(result);
    }