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. CentOS7下 简单安装和配置Elasticsearch Kibana Filebeat 快速搭建集群日志收集平台

    目录 1.添加elasticsearch官网的yum源 2.Elasticsearch 安装elasticsearch 配置elasticsearch 启动elasticsearch并设为开机启动 3 ...

  2. Spring框架使用(控制反转,依赖注入,面向切面AOP)

    参见:http://blog.csdn.net/fei641327936/article/details/52015121 Mybatis: 实现IOC的轻量级的一个Bean的容器 Inversion ...

  3. Android(4.0.3+): Service, AsyncTask, 定时任务和UI通信

    Service使用AlarmManager实现后台定时任务 在Android 4.0.3版本中, 使用AlarmManager实现后台定时任务是比较好的方案, 其实现机制, 是利用Service的 o ...

  4. 开源分布式搜索平台ELK(Elasticsearch+Logstash+Kibana)入门学习资源索引

    from:  http://www.w3c.com.cn/%E5%BC%80%E6%BA%90%E5%88%86%E5%B8%83%E5%BC%8F%E6%90%9C%E7%B4%A2%E5%B9%B ...

  5. Android 百度鹰眼轨迹SDK(v2.1.6)

    闲聊 看过<鹰眼追击>这部电影的读者一定对"鹰眼"这台巨无霸计算机印象深刻,如今我们能够实现自己的鹰眼. 效果图 本篇为百度地图SDK第三篇博文 第一篇实现:Andro ...

  6. 不能添加重复的Contact到RecipientBox中

    不能添加重复的Contact到RecipientBox中 在开始添加的操作时,判断是否已在RecipientBox中,如果已经在返回值为null的TextView. 再根据TextView判断是否nu ...

  7. 【PHP5.3+】获取getCurrentUrl()中 的地址url

    1.在控制器中调用其他 扩展或者类 的方法时候,getCurrentUrl()方法 是获取的[当前控制器下方法]的路由,不是[其他 扩展或者类 方法]的路由!!! 2.getCurrentUrl()方 ...

  8. 阿里云安装jdk,tomcat,maven,svn,git,nginx

    1. 首先通过xftp等工具上传安装包 2. 配置目录 cd usr mkdir java cd java mkdir jdk mkdir tomcatmkdir maven 3. 安装jdk 3.1 ...

  9. [SQL] 请教一下 count里面有case when 一般情况下啥时候用

    http://www.itpub.net/forum.php?mod=viewthread&tid=1810967 问题: 比如 count(case when  pday_id=${deal ...

  10. 树莓派进阶之路 (024) - windows远程桌面连接树莓派通过xrdp服务(转)

    本文转载:http://www.cnblogs.com/edgexie/p/6527992.html 在网上看到很多关于windows远程桌面连接树莓派的教程.我也按照教程试过了,遇到了几个坑.特意记 ...