这是我的代码,用于确定单词是否包含任何非字母数字字符:
String term = "Hello-World";
boolean found = false;
Pattern p = Pattern.Compile("\\W*");
Matcher m = p.Matcher(term);
if(matcher.find())
found = true;
Run Code Online (Sandbox Code Playgroud)
我想知道正则表达式是否错误.我知道"\W"会匹配任何非单词字符.对我失踪的任何想法?
我是 angular js 和 moment.js 的新手,我有以下代码,它给出了一周的开始日和结束日,例如 1 月 17 日至 1 月 23 日。但我希望在 1 月 17 日星期一以这种格式的所有 7 天。
我的代码
var currentDate,
weekStart,
weekEnd,
shortWeekFormat = 'MMMM Do';
function setCurrentDate(aMoment){
currentDate = aMoment,
weekStart = currentDate.clone().startOf('week'),
weekEnd = currentDate.clone().endOf('week')
}
setCurrentDate(moment());
$scope.currentWeek = function(){ return currentDate.format(shortWeekFormat); };
$scope.currentWeekStart = function(){ return weekStart.format(shortWeekFormat); };
$scope.currentWeekEnd = function(){ return weekEnd.format(shortWeekFormat); };
Run Code Online (Sandbox Code Playgroud)
HTML
<h2><i class="fa fa-arrow-left"></i>Week Of {{currentWeek()}}{{currentWeekStart()}}-{{currentWeekEnd()}}<i class="fa fa-arrow-right"></i></h2>
<button ng-click="prevWeek()">previous week</button>
<button ng-click="nextWeek()">next week</button>
Run Code Online (Sandbox Code Playgroud) 我在 Chrome 开发者工具窗口的“样式”选项卡中看到以下 css 代码:
element.style {
height: auto;
width: 100%;
margin-top: -148px;
}
Run Code Online (Sandbox Code Playgroud)
我想用 .css 文件中的 css 代码覆盖它:
.so-widget-sow-simple-masonry-simple-masonry-d75171398898 .sow-masonry-grid-item img {
width: auto;
height: 244px;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
}
Run Code Online (Sandbox Code Playgroud)
但样式定义element.style已经存在了。我找不到 .js 这么快。有人能帮我吗?谢谢
概观
我有一些数据存储在与产品相关的MySql数据库中.我正在尝试检索此数据并使用HTML表格在页面上显示它.PHP和MySql运行良好,所有数据都被检索到,但它以非常混乱的方式显示.
这是我的布局:

我的目标是进一步划分结果表添加更多列行以使数据更具可读性
像这样的东西;

代码:PHP,MySQL和HTML:
<?php
session_start();
include('connect_mysql.php');
$product_name = 'product_name';
$product_qua = 'product_qua';
$product_price = 'product_price';
$product_image = 'product_image';
$product_des = 'product_des';
$sql = mysql_query("SELECT * FROM products");
echo "<table id='display'>";
while($rows = mysql_fetch_array($sql))
{
echo"<br>";
echo"<tr><td>";
echo"$rows[$product_name]<br></td>";
echo"<td><img src=$rows[$product_image] height='200px' width='200px'><br></td>";
echo"<td>Avalible: $rows[$product_qua]<br></td>";
echo"<td>Price: $rows[$product_price]<br></td>";
echo"<td>Description: $rows[$product_des]<br></td>";
echo"</tr>";
}
echo "</table>";
?>
Run Code Online (Sandbox Code Playgroud)
负责此部分的CSS:
#display{
float:left;
border: 5px solid black;
margin-left:100px;
}
Run Code Online (Sandbox Code Playgroud) css ×2
html ×2
java ×2
regex ×2
alphanumeric ×1
angularjs ×1
date ×1
days ×1
javascript ×1
momentjs ×1
mysql ×1
php ×1
siteorigin ×1