https://www.java-forums.org/new-java/42610-java-regular-expressions-comma-seperated-list.html

https://stackoverflow.com/questions/14166149/regex-for-comma-separated-values

https://blog.oio.de/2012/08/23/split-comma-separated-strings-in-java/

https://dzone.com/articles/regular-expression-to-validate-a-comma-separated-l

Hi there guys,

I'm new to these forums but basically I have a little query about regular expressions.

Basically I have a project where I load in a text file containing an unlimited length of comma separated list of strings where the last string doesn't have a comma at the end of it.

e.g.:
johnny,matinay,crazy,rampage,eastpak,ghghg

All I want to do is to create a regular expression that will ensure that there is a comma separated list of strings where in each string there are alphanumeric characters, the "&" sign and white space but NO commas inside the string (since that is what the list is split with), so if the above list was changed to "johnny,matinay,,rampage,eastpak,ghghg" where there is one comma straight after the other then the regular expression would pick this up and throw an error.

All I have so far is:
[^,]+[,].+

But i'm not sure where to go from there.

Thanks in advance guys!

[^,]+[,].+

DOUHAO的更多相关文章

  1. 表达式求值(河南省第四届ACM试题-C题)题解

    以防万一,题目原文和链接均附在文末.那么先是题目分析: [一句话题意] 给定指定的一个由3种函数组成的表达式,计算其数值. [题目分析] 一开始以为是后缀表达式,后来抽了没想出来,最后用了递归的方法解 ...

  2. python3入门之print,import,input介绍

    本节主要介绍print,import和input,t函数,包括他们在python2.7和python3 的区别以及用法.下面附有之前的文章: ​ python3的print函数的变化 python3之 ...

  3. WPF实现软键盘

    wpf 实现一个软键盘, 先发个图: 工作有需要实现一个软键盘,本来想用windows自带的软键盘凑合凑合得了,又觉得那个软键盘太大了,所以自己实现了一个. 说一下实现的思路,其实没什么思路 界面就是 ...

随机推荐

  1. XC文件管理器-打造优美易用的文件管理器

    技术:Android+java   概述 XC文件管理器,是基于Android6.0+开发的一个方便易用的文件管理器,具有文件的目录管理和文件的管理,主要包括文件的新建.删除.重命名.复制,移动剪切以 ...

  2. Android 自定义控件-高仿猎豹清理大师自定义内存开口圆环控件

    技术:Android+java   概述 看见猎豹清理大师的内存开口圆环比例进度 挺有意思的,于是就是想自己实现下这样的效果,于是反编译了猎豹清理 大师的app看了下,原来是有两张图,于是脑子里就过了 ...

  3. 【onethink1.0】HTML模板获取前台和后台当前登录用户名

    1.版本:onethink1.0:位置:HTML模板 前台:{:get_username()} 后台:{:session('user_auth.username')}

  4. SqlServer安装时的选项说明

    转自:https://blog.csdn.net/m0_37154839/article/details/80233446 看看组件的功能说明吧 服务器组件 说明 SQL Server 数据库引擎 S ...

  5. tensorflow代码中的一个bug

    tensorflow-gpu版本号 pip show tensorflow-gpu Name: tensorflow-gpu Version: 1.11.0 Summary: TensorFlow i ...

  6. ios 协议分析

    1 基本用途 可以用来声明一大堆方法(不能声明成员变量) 只要某个类遵守了这个协议,就相当于拥有了这个协议中的所有方法声明 只要父类遵守了某个协议,就相当于子类也遵守了 2 格式 协议的编写 @pro ...

  7. 开发只懂 AFN ?搞定 NSURLSession 才是硬道理

    由于傲娇的苹果在 iOS9 之后已经放弃了 NSURLConnection,所以在现在的实际开发中,除了大家常见的 AFN 框架,一般使用的是 iOS7 之后推出的 NSURLSession,作为一名 ...

  8. k8s源码分析之kubelet

    一.概述 二.Kubelet对象创建过程:(pkg/kubelet/kubelet.go ) NewMainKubelet 正如名字所示,主要的工作就是创建 Kubelet 这个对象,它包含了 kub ...

  9. numpy 数组创建例程

    1 numpy.empty empty(shape[, dtype=float, order='C']) 创建指定 shape 和dtype 的未初始化数组 返回:ndarray. 说明:order ...

  10. docker学习笔记 --- centos install

    Docker简介: Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源. Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发 ...