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. 视频转换ffmpeg

    使用yum在centos下安装ffmpeg   ffmpeg -i IMG_1893.MOV -ab 56 -ar 22050 -b 500 -r 15 -s 640x480 test.mp4   说 ...

  2. Oracle自学笔记(一)

    1.创建用户并指定表空间 create user gy_3004 identified by gy_3004 default tablespace gy_3004_data temporary tab ...

  3. ASP.NET 对类进行XML序列化和反序列化

    1 序列化方法 public void SerializeObject<T>(string Xmlname,T t) { XmlSerializer ser = new XmlSerial ...

  4. Swift3 URL编码、解码用法addingPercentEncoding

    我们请求一个url时,最好要对其编码,转换成url识别的字符,以应对url里可能存在的中文.特殊符号等. swift3之前用法: url.stringByAddingPercentEscapesUsi ...

  5. 路由器下CLI界面

    CLI(command-line interface,命令行界面)是指可在用户提示符下键入可执行指令的界面. CLI是Command Line Interface的缩写,即命令行界面.CLI界面是所有 ...

  6. Mysql DBA 20天速成教程

    Mysql DBA 20天速成教程 基本知识1.mysql的编译安装2.mysql 第3方存储引擎安装配置方法3.mysql 主流存储引擎(MyISAM/innodb/MEMORY)的特点4.字符串编 ...

  7. 富文本编辑器 CKeditor 配置使用

    作者:Tyler Ning出处:http://www.cnblogs.com/tylerdonet/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连 ...

  8. 根据友盟统计错误分析线上的崩溃-b

    登陆友盟官网找到友盟统计,找到你iOS平台下你所属的APP(图1) 图1 点击进去会出现当日错误列表,选择你发生错误的日期(图2) 图2 我们可以看到,这一天中出现了两个错误,每个错误出现在不同的时间 ...

  9. Docker 构建Hadoop环境

    参考如下文章: Docker安装Hadoop Docker在本地搭建Hadoop分布式集群 Docker快速搭建Hadoop测试环境 从0开始用docker搭建 hadoop分布式环境 Docker- ...

  10. linux记录sftp命令

    使用以下配置方法不需要配置chroot. 编辑sshd_config文件 vi /etc/ssh/sshd_config 增加: Subsystem sftp /usr/libexec/openssh ...